Skip to content

Commit 2f8b8d4

Browse files
committed
Avoid exception in isService on Windows
1 parent b8f1c6e commit 2f8b8d4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ exports.createServer = function (responder, authorizer, filter, config) {
5050
return new server.Server(responder, authorizer, filter, config);
5151
};
5252

53-
exports.isService = function () {
54-
return fs.fstatSync(0).isSocket();
53+
if (process.platform === "win32") {
54+
exports.isService = function () {
55+
return false; // On windows we need to call GetStdHandle(-10)
56+
// from kernel32.dll
57+
}
58+
} else {
59+
exports.isService = function () {
60+
return fs.fstatSync(0).isSocket();
61+
}
5562
}

0 commit comments

Comments
 (0)