From 494c53971c449a125bbd1f2cbfbad25b5035b024 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 5 Jan 2023 19:22:15 +0800 Subject: [PATCH] Convert to UTF8 on Windows only --- server/util-server.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/util-server.js b/server/util-server.js index 3f55b3d7d..99c9c9322 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -26,6 +26,8 @@ const { } = require("node-radius-utils"); const dayjs = require("dayjs"); +const isWindows = process.platform === /^win/.test(process.platform); + /** * Init or reset JWT secret * @returns {Promise} @@ -106,7 +108,11 @@ exports.pingAsync = function (hostname, ipv6 = false) { if (res.alive) { resolve(res.time); } else { - reject(new Error(exports.convertToUTF8(res.output))); + if (isWindows) { + reject(new Error(exports.convertToUTF8(res.output))); + } else { + reject(new Error(res.output)); + } } }).catch((err) => { reject(err);