Return to Snippet

Revision: 30506
at August 16, 2010 05:37 by viatropos


Initial Code
// http://nodejs.org/api.html#_child_processes
var sys = require('sys')
var exec = require('child_process').exec;
var child;

// executes `pwd`
child = exec("pwd", function (error, stdout, stderr) {
  sys.print('stdout: ' + stdout);
  sys.print('stderr: ' + stderr);
  if (error !== null) {
    console.log('exec error: ' + error);
  }
});

Initial URL
execute-a-unix-command-with-node-js

Initial Description


Initial Title
Execute a Unix Command with Node.js

Initial Tags
unix

Initial Language
JavaScript