|
|
@ -103,12 +103,10 @@ exports.pingAsync = function (hostname, ipv6 = false) {
|
|
|
|
min_reply: 3
|
|
|
|
min_reply: 3
|
|
|
|
}).then((res) => {
|
|
|
|
}).then((res) => {
|
|
|
|
// If ping failed, it will set field to unknown
|
|
|
|
// If ping failed, it will set field to unknown
|
|
|
|
if (!res.alive && res.host === "unknown") {
|
|
|
|
if (res.alive) {
|
|
|
|
reject(new Error("Name or service not known"));
|
|
|
|
|
|
|
|
} else if (res.time === "unknown") {
|
|
|
|
|
|
|
|
reject(new Error(res.output));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
resolve(res.time);
|
|
|
|
resolve(res.time);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
reject(new Error(exports.convertToUTF8(res.output)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
}).catch((err) => {
|
|
|
|
reject(err);
|
|
|
|
reject(err);
|
|
|
|