Skip to content

Commit

Permalink
Avoid exception in isService on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
fbbdev committed Oct 18, 2016
1 parent b8f1c6e commit 2f8b8d4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ exports.createServer = function (responder, authorizer, filter, config) {
return new server.Server(responder, authorizer, filter, config);
};

exports.isService = function () {
return fs.fstatSync(0).isSocket();
if (process.platform === "win32") {
exports.isService = function () {
return false; // On windows we need to call GetStdHandle(-10)
// from kernel32.dll
}
} else {
exports.isService = function () {
return fs.fstatSync(0).isSocket();
}
}

1 comment on commit 2f8b8d4

@fbbdev
Copy link
Owner Author

@fbbdev fbbdev commented on 2f8b8d4 Oct 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #17

Please sign in to comment.