Skip to content

Instantly share code, notes, and snippets.

@billroy
Created June 18, 2012 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billroy/2949381 to your computer and use it in GitHub Desktop.
Save billroy/2949381 to your computer and use it in GitHub Desktop.
var util = require('util'),
spawn = require('child_process').spawn;
var taskid = 1;
var numtasks = 4;
while (taskid <= numtasks) {
console.log('Spawning', taskid);
var task = spawn('python', ['potato.py', '-x', '3', '-n', taskid++])
task.stdout.on('data', function (data) {
process.stdout.write(data);
});
task.stderr.on('data', function (data) {
process.stderr.write(data);
});
task.on('exit', function (code) {
console.log('Exit:', code);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment