diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-08-02 04:40:46 +0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-08-02 04:40:57 +0400 |
commit | 2908f323e1cabd44329c8fcf67fd4b1fde41030b (patch) | |
tree | 8ce4e298fb04ce0410d1d4cba8e701407222a660 /test | |
parent | a44748b3d7a53c710ee286c010e74d8aca117723 (diff) |
win: fix test-child-process-exec-cwd
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-child-process-exec-cwd.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/simple/test-child-process-exec-cwd.js b/test/simple/test-child-process-exec-cwd.js index 80c42bc6107..fb9f13801a5 100644 --- a/test/simple/test-child-process-exec-cwd.js +++ b/test/simple/test-child-process-exec-cwd.js @@ -26,7 +26,17 @@ var exec = require('child_process').exec; var success_count = 0; var error_count = 0; -var child = exec('pwd', {cwd: '/dev'}, function(err, stdout, stderr) { +var pwdcommand, dir; + +if (process.platform == 'win32') { + pwdcommand = 'echo %cd%'; + dir = 'c:\\windows'; +} else { + pwdcommand = 'pwd'; + dir = '/etc'; +} + +var child = exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) { if (err) { error_count++; console.log('error!: ' + err.code); @@ -35,7 +45,8 @@ var child = exec('pwd', {cwd: '/dev'}, function(err, stdout, stderr) { assert.equal(false, err.killed); } else { success_count++; - assert.equal(true, /^\/dev\b/.test(stdout)); + console.log(stdout); + assert.ok(stdout.indexOf(dir) == 0); } }); |