Skip to content

Commit

Permalink
Use error.code instead of .errno in server/shell.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Newman committed Jan 29, 2015
1 parent d75f188 commit 26ebc82
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/server/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports.listen = function listen(shellDir, retryCount) {
net.createServer(function(socket) {
onConnection(socket, shellDir);
}).on("error", function(err) {
if (err.errno === "EADDRINUSE" && retryCount < 5) {
if (err.code === "EADDRINUSE" && retryCount < 5) {
setTimeout(function() {
listen(shellDir, retryCount + 1);
}, 500);
Expand Down Expand Up @@ -304,13 +304,13 @@ exports.connect = function(shellDir) {
function onError(err) {
tearDown();

if (err.errno === "ENOENT" ||
err.errno === "ECONNREFUSED") {
if (err.code === "ENOENT" ||
err.code === "ECONNREFUSED") {
// If the shell.sock file is missing or looks like a socket but is
// not accepting connections, keep trying to connect.
reconnect();

} else if (err.errno === "ENOTSOCK") {
} else if (err.code === "ENOTSOCK") {
// When the server shuts down completely, it replaces the
// shell.sock file with a regular file to force connected shell
// clients to disconnect and exit. If this shell client is
Expand Down

0 comments on commit 26ebc82

Please sign in to comment.