Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created September 13, 2011 12: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 hitode909/1213710 to your computer and use it in GitHub Desktop.
Save hitode909/1213710 to your computer and use it in GitHub Desktop.
var rl = require('readline');
var cp = require('child_process');
var i = rl.createInterface(process.stdin, process.stdout, null);
i.setPrompt('%node% ');
i.on('line', function (cmd) {
cp.exec(cmd, function (error, stdout, stderr) {
if (stdout.length > 0) console.log(stdout);
if (stderr.length > 0) console.log(stderr);
i.prompt();
});
});
i.on('close', function() {
process.exit(0);
});
i.prompt();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment