2.0.1 • Published 7 years ago

smart-spawn v2.0.1

Weekly downloads
58
License
LGPL-3.0+
Repository
github
Last release
7 years ago

smart-spawn

Spawn an async process and get back stdout, handling errors

Installation

npm install smart-spawn

Usage

var smartSpawn = require('smart-spawn');

var process = smartSpawn('ls', ['-l'], process.cwd(), function(err, stdout) {
	if (err) throw err;

	console.log(stdout);
}

Arguments

Arguments are, in order: the name of the process to spawn, arguments passed to the subprocess, the subprocess' working directory, and a callback function.

The callback receives two arguments. The first is an Error object which is passed if the process couldn't be spawned or if it exited with a nonzero exit code, otherwise it's undefined. The second is the process' stdout upon its completion (regardless of any errors that may have occured).

Return value

smart-spawn will return an instance of ChildProcess representing the spawned subprocess.

License

LGPL 3.0+

Author

Alex Jordan alex@strugee.net

2.0.1

7 years ago

2.0.0

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago