$ cnpm install exec-sync
Execute shell command synchronously. Use this for migration scripts, cli programs, but not for regular server code.
$ curl http://npmjs.org/install.sh | sh
$ cd /path/to/your/project
$ [sudo] npm install exec-sync
Warning: use only for special operation or command line scripts written with node. Don't use this for regular server code or it will ruin the responsiveness of your server.
var execSync = require('exec-sync');
var user = execSync('echo $USER');
console.log(user);
Throw error when something went wrong.
Copyright 2013 - present © cnpmjs.org | Home |