@dogmalang/exec
Functions for executing lines from shell.
Engineered in Valencia, Spain, EU by Justo Labs.
Use
const {exec, execf, pexec} = require("@dogmalang/exec");
exec()
It executes a command:
function exec(...cmd) : object
function exec(...cmd, opts:object) : object
function exec(...cmd, callback:function) : object
-
cmd
, the command to run. -
callback
, the function to call when the run ended. -
opts
, the options:-
workDir
(string), the work directory to use. -
env
(object), the environment variables to use. -
detach
(bool), detach the execution? Whencallback
, this option is alwaystrue
. -
enc
(string), the output encoding. -
async
(bool), asynchronously? Iftrue
, the function returns a promise. Default:false
.
-
execf()
Similar to exec()
, but for a command with format:
function execf(fmt:string, ...args) : object
function execf(fmt:string, ...args, opts:object) : object
function execf(fmt:string, ...args, callback:function) : object
pexec()
Similar to exec()
but in protected mode:
function pexec(...cmd) : [ok, result]
function pexec(...cmd, opts: object) : [ok, result]
function pexec(...cmd, callback:function) : [ok, result]