Node Module that only requires a single function call to execute some bash/shell code in a child_process
npm i v_execute --save
Well just load it as a constant...and have fun...
const { v_execute, hof_v_cp } = require('./v_execute')
// Simple listing
console.log( await v_execute("ls") ) //-> { stdout, stderr }
// Check git status
console.log( await v_execute("git status") )
// Create a child_process
const cp = hof_v_cp(
undefined,
(data)=> console.log(data), // stdout.on('data', cbFn)
(data) => console.warn(data) // stderr.on('data', cbFn)
)
cp.runCmd("ls")
cp.sendCommand("ls")
console.log(cp.child) //-> child_process instance
import { v_execute, hof_v_cp } from 'v_execute'
// Simple listing
console.log( await v_execute("ls") ) //-> { stdout, stderr }
// Check git status
console.log( await v_execute("git status") )
// Create a child_process
const cp = hof_v_cp(
undefined,
(data)=> console.log(data), // stdout.on('data', cbFn)
(data) => console.warn(data) // stderr.on('data', cbFn)
)
cp.runCmd("ls")
cp.sendCommand("ls")
console.log(cp.child) //-> child_process instance