Created
February 22, 2011 16:30
-
-
Save koichik/838920 to your computer and use it in GitHub Desktop.
Fix process.stdout.end() throws ENOTSOCK error.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1a8c385beb360b887c636c7500aa91602a37720c Mon Sep 17 00:00:00 2001 | |
From: koichik <koichik@improvement.jp> | |
Date: Wed, 23 Feb 2011 01:28:09 +0900 | |
Subject: [PATCH] Fix process.stdout.end() throws ENOTSOCK error. | |
--- | |
src/node.js | 5 +++++ | |
1 files changed, 5 insertions(+), 0 deletions(-) | |
diff --git a/src/node.js b/src/node.js | |
index 789cb9b..30c2b76 100644 | |
--- a/src/node.js | |
+++ b/src/node.js | |
@@ -139,6 +139,11 @@ | |
if (binding.isatty(fd)) { | |
stdout = new tty.WriteStream(fd); | |
+ // FIXME Should probably have an option in net.Stream to create a | |
+ // stream from an existing fd which is writable only. But for now | |
+ // we'll just add this hack and set the `readable` member to false. | |
+ // Test: ./node test/fixtures/echo.js < /etc/passwd | |
+ stdout.readable = false; | |
} else if (binding.isStdoutBlocking()) { | |
stdout = new fs.WriteStream(null, {fd: fd}); | |
} else { | |
-- | |
1.7.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment