brsolab-process
Wrapper for Nodejs Child process library Uses the ES6 to make it simple the use of subprocess in nodeJS
This library contains 3 functions: spawn, exec, and escape spawn is used to create processes. exec is used to execute commandes via the system interpreter (SH, BATCH, MS-DOS, ...) escape is used to escape arguments to exec commande
Those two functions use the some options as the original ones of nodejs. See the doc page at: https://nodejs.org/api/child_process.html
spawn
/** * spawn process * spaw(cmd, [args, [options, [processInitCallBack]]]) * spaw(cmd, [args, [processInitCallBack]]) * @param * @param * @param * timeout * cwd * env * argv0 * stdio{Array | String}: Child's stdio configuration * detached * uid * gid * shell{boolean|string}: If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. A different shell can be specified as a string. * @return */ const spawn = ;var list = await ;
exec
/** * exec process * exec(cmd, [options, [processInitCallBack]]) * spaw(cmd, [processInitCallBack]) * @param * @param * @param * timeout * cwd * env * argv0 * stdio{Array | String}: Child's stdio configuration * detached * uid * gid * shell{boolean|string}: If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. A different shell can be specified as a string. * @return */ const exec escape = ;var list = await ;await ;
examples
const spawn exec = ;const fs = ; ; // it's better to use "async" & "await"{ result = await ; console; // pipe the output to a file await ; // send messages to process var result = await ;};