Created
August 24, 2012 23:56
-
-
Save nzakas/3457511 to your computer and use it in GitHub Desktop.
Devil spawn
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
#!/usr/bin/env node | |
var child = require('child_process'); | |
var cp = child.spawn("dir", [""]); | |
cp.stdout.on("data", function(data) { | |
console.log(data.toString()); | |
}); | |
cp.stderr.on("data", function(data) { | |
console.error(data.toString()); | |
// Output: CreateProcessW: The system cannot find the file specified. | |
}); | |
// Using Node.js v0.8.8 on Windows 7 64-bit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dir is not an executable in windows. It is command on cmd.exe. You should call "cmd.exe /c dir"