From 128fb7ce55110f8e205259855901aeddfba7009e Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Fri, 28 Aug 2015 09:34:28 -0700 Subject: [PATCH] Make `meteor shell` not crash when piped from another command. This commit makes possible but but doesn't fully solve the problem of using `meteor shell` within shell scripts. See #5055 for more details. Closes #5056 --- History.md | 2 ++ tools/shell-client.js | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index ee2000fe6f..295b977fec 100644 --- a/History.md +++ b/History.md @@ -230,6 +230,8 @@ ### `meteor` command-line tool +* `meteor shell` no longer crashes when piped from another command. + * Avoid a race condition in `meteor --test` and work with newer versions of the Velocity package. #3957 diff --git a/tools/shell-client.js b/tools/shell-client.js index 75a5fbcac8..d31668dad0 100644 --- a/tools/shell-client.js +++ b/tools/shell-client.js @@ -103,7 +103,9 @@ Cp.setUpSocket = function setUpSocket(sock, key) { process.stderr.write(shellBanner()); process.stdin.pipe(sock); - process.stdin.setRawMode(true); + if (process.stdin.setRawMode) { // https://github.com/joyent/node/issues/8204 + process.stdin.setRawMode(true); + } } function onClose() { @@ -125,7 +127,9 @@ Cp.setUpSocket = function setUpSocket(sock, key) { function tearDown() { self.connected = false; - process.stdin.setRawMode(false); + if (process.stdin.setRawMode) { // https://github.com/joyent/node/issues/8204 + process.stdin.setRawMode(false); + } process.stdin.unpipe(sock); sock.unpipe(process.stdout); sock.removeListener("connect", onConnect);