Added not active condition to prevent false error
Added a check to see if the host is alive. This prevents failiures when the user specifies a hostname of `unknown`. Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
parent
73835f3328
commit
69e1880cd3
|
@ -103,7 +103,7 @@ 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.host === "unknown") {
|
if (!res.alive && res.host === "unknown") {
|
||||||
reject(new Error("Name or service not known"));
|
reject(new Error("Name or service not known"));
|
||||||
} else if (res.time === "unknown") {
|
} else if (res.time === "unknown") {
|
||||||
reject(new Error(res.output));
|
reject(new Error(res.output));
|
||||||
|
|
Loading…
Reference in New Issue