mirror of https://github.com/lukechilds/node.git
committed by
Ryan Dahl
4 changed files with 62 additions and 23 deletions
@ -0,0 +1,26 @@ |
|||
require('../common'); |
|||
var TEST_STR = "abc\n123\nhello world\nsomething else" |
|||
, path = require('path') |
|||
, childProccess = require('child_process') |
|||
, fs = require('fs') |
|||
, stdoutScript = path.join(fixturesDir, 'echo.js') |
|||
, tmpFile = path.join(fixturesDir, 'stdin.txt') |
|||
, cmd = process.argv[0] + ' ' + stdoutScript + ' < ' + tmpFile |
|||
; |
|||
|
|||
puts(cmd + "\n\n"); |
|||
|
|||
try { |
|||
fs.unlinkSync(tmpFile); |
|||
} catch (e) {} |
|||
|
|||
fs.writeFileSync(tmpFile, TEST_STR); |
|||
|
|||
childProccess.exec(cmd, function(err, stdout, stderr) { |
|||
fs.unlinkSync(tmpFile); |
|||
|
|||
if (err) throw err; |
|||
puts(stdout); |
|||
assert.equal(stdout, "hello world\r\n" + TEST_STR); |
|||
assert.equal("", stderr); |
|||
}); |
Loading…
Reference in new issue