Skip to content

Instantly share code, notes, and snippets.

@nzakas
Created August 24, 2012 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nzakas/3457511 to your computer and use it in GitHub Desktop.
Save nzakas/3457511 to your computer and use it in GitHub Desktop.
Devil spawn
#!/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
@jrocha
Copy link

jrocha commented Aug 25, 2012

dir is not an executable in windows. It is command on cmd.exe. You should call "cmd.exe /c dir"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment