mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-09 23:24:07 -08:00
Convert to UTF8 on Windows only
This commit is contained in:
parent
4239cf4255
commit
494c53971c
|
@ -26,6 +26,8 @@ const {
|
||||||
} = require("node-radius-utils");
|
} = require("node-radius-utils");
|
||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
|
|
||||||
|
const isWindows = process.platform === /^win/.test(process.platform);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init or reset JWT secret
|
* Init or reset JWT secret
|
||||||
* @returns {Promise<Bean>}
|
* @returns {Promise<Bean>}
|
||||||
|
@ -106,7 +108,11 @@ exports.pingAsync = function (hostname, ipv6 = false) {
|
||||||
if (res.alive) {
|
if (res.alive) {
|
||||||
resolve(res.time);
|
resolve(res.time);
|
||||||
} else {
|
} else {
|
||||||
|
if (isWindows) {
|
||||||
reject(new Error(exports.convertToUTF8(res.output)));
|
reject(new Error(exports.convertToUTF8(res.output)));
|
||||||
|
} else {
|
||||||
|
reject(new Error(res.output));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
reject(err);
|
reject(err);
|
||||||
|
|
Loading…
Reference in a new issue