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
This commit is contained in:
Avital Oliver
2015-08-28 09:34:28 -07:00
parent fe42ea9cb1
commit 7abbceabdf
2 changed files with 8 additions and 2 deletions

View File

@@ -169,6 +169,8 @@ message for more details.
### `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

View File

@@ -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);