Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
Created March 1, 2013 00:33
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 sindresorhus/5061438 to your computer and use it in GitHub Desktop.
Save sindresorhus/5061438 to your computer and use it in GitHub Desktop.
The `works.js` outputs `Serving HTTP on 0.0.0.0 port 8010 ...` while the `doesnotwork.js` doesn't output anything. Am I missing something? Node v0.8.21
var spawn = require('child_process').spawn;
var cp = spawn('python', ['-m', 'SimpleHTTPServer', '8010']);
cp.stdout.setEncoding('utf8');
cp.stderr.setEncoding('utf8');
cp.stdout.on('data', function (data) {
console.log('stdout', data);
});
cp.stderr.on('data', function (data) {
console.log('stderr', data);
});
cp.on('exit', function (data) {
console.log('exit', data);
});
var spawn = require('child_process').spawn;
spawn('python', ['-m', 'SimpleHTTPServer', '8010'], {
stdio: 'inherit'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment