Created
March 23, 2011 23:20
-
-
Save baudehlo/884245 to your computer and use it in GitHub Desktop.
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
matt@Valour /tmp$ cat client.js | |
var fullchunk; | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
process.stdin.on('data', function (chunk) { | |
if (!fullchunk) { | |
fullchunk = ""; | |
} | |
fullchunk += chunk; | |
}); | |
process.stdin.once('end', function () { | |
process.stdin.removeAllListeners('data'); | |
eval(fullchunk); | |
console.log("Eval: >>" + fullchunk + "<<"); | |
}); | |
matt@Valour /tmp$ cat server.js | |
require("http").createServer(function(request, response) { | |
console.log("connection!"); | |
response.writeHead(200); | |
response.end("Hello World"); | |
}).listen(3000); | |
matt@Valour /tmp$ node client.js < server.js | |
Eval: >>require("http").createServer(function(request, response) { | |
console.log("connection!"); | |
response.writeHead(200); | |
response.end("Hello World"); | |
}).listen(3000); | |
<< | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment