Skip to content

Instantly share code, notes, and snippets.

@marcelklehr
Created July 2, 2012 15:28
Show Gist options
  • Save marcelklehr/3033789 to your computer and use it in GitHub Desktop.
Save marcelklehr/3033789 to your computer and use it in GitHub Desktop.
Emulating a terminal command with node
var exec = require('child_process').spawn;
var node = exec('node', process.argv.splice(2), {stdio: 'inherit'});
@marcelklehr
Copy link
Author

Usage:

$ node emulate.js emulate.js emulate.js emulate.js -v

Prints the global node version

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