shell
Simple exec of shell commands in node
const { shell } = require('@pawelgalazka/shell')
shell('touch somefile.js')
shell('http-server', { async: true })
shell(cmd, options)
Options:
{
cwd: ...,
async: ...
env: ...
timeout: ...
transform:
nopipe:
silent:
}
interface IShellOptions {
cwd?: string
env?: NodeJS.ProcessEnv
timeout?: number
async?: boolean
nopipe?: boolean
silent?: boolean
transform?: (output: string) => string
}
prefixTransform(prefix)
Transform function which can be used for transform
option.
Example:
const { shell, prefixTransform } = require('@pawelgalazka/shell')
shell('echo "test"', { transform: prefixTransform('[prefix]') })
$ node ./script.js
echo "test"
[prefix] test