Skip to content

[.v.] Node Module that only requires a single function call to execute some bash/shell code in a child_process

License

Notifications You must be signed in to change notification settings

V-tech-tools/v_execute

Repository files navigation

🌀 v_execute( <_command_> )

Node Module that only requires a single function call to execute some bash/shell code in a child_process

⏩ Installing__

npm i v_execute --save

💥 How to use__

Well just load it as a constant...and have fun...

Common JS

  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

ES Modules

  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

👻 Author: -<[_.⟁._]>-

⏰ CreatedTime: 07.01.2023 @ 15:44

About

[.v.] Node Module that only requires a single function call to execute some bash/shell code in a child_process

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published