Skip to content
forked from mgutz/execSync

node.js synchronous exec when you NEED it

License

Notifications You must be signed in to change notification settings

doxout/execSync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

execSync

Executes shell commands synchronously.

Does not work on Windows

Motivation

Simplifies build scripts.

Express 3 has asynchronous templates and helper functions are synchronous. Some of my helper functions invoke compilers with async interfaces. I use this library in DEVELOPMENT mode to precompile files on the fly through the command line.

NOT RECOMMENDED on production servers.

Install

npm install execSync

Usage

Require it

var execSync = require('execSync');

Execute shell commands. exec interlaces stdout and stderr to result.stdout.

var result = execSync.exec('echo $USER; echo some_err 1>&2; exit 1');
console.log('return code ' + result.code);
console.log('stdout + stderr ' + result.stdout);

Legacy helper functions

Capture STDOUT

var user = execSync.stdout('echo $USER');
console.log('Hello ' + user);

Get result code

var code = execSync.code('echo $HOME');
console.log('result ' + code);

License

Copyright (c) 2012, 2013 Mario Gutierrez [email protected]

See the file LICENSE for copying permission.

About

node.js synchronous exec when you NEED it

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%