exec-series
A Node module to run commands in order
const execSeries = ; ;
On Linux, you can do almost the same thing with &&
operator like below:
const exec = ; ;
However, some environments, such as Windows PowerShell, don't support &&
operator. This module helps you to create a cross-platform Node program.
Installation
npm install exec-series
API
const execSeries = ;
execSeries(commands [, options, callback])
commands: Array
of String
(the commands to run)
options: Object
(child_process.exec options with maxBuffer
defaulting to 10 MB)
callback: Function
It sequentially runs the commands using child_process.exec. If the first command has finished successfully, the second command will run, and so on.
After the last command has finished, it runs the callback function.
When one of the commands fails, it immediately calls the callback function and the rest of the commands won't be run.
callback(error, stdoutArray, stderrArray)
error: Error
if one of the commands fails, otherwise undefined
stdoutArray: Array
of String
(stdout of the commands)
stderrArray: Array
of String
(stderr of the commands)
;
Callback function is optional.
; ;
License
Copyright (c) 2014 - 2016 Shinnosuke Watanabe
Licensed under the MIT License.