
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
@keg-hub/spawn-cmd
Advanced tools
// With Yarn
yarn add @keg-hub/spawn-cmd
// With NPM
npm install @keg-hub/spawn-cmd
// * Require code
const { spawnCmd } = require('@keg-hub/spawn-cmd')
// Spawns a new terminal session and runs `ls -la` inside of it
await spawnCmd('ls -la')
// Pass in a config object as the second argument
// See more information about the config in the config section
const config = { args: [ '-la' ] cwd: __dirname }
await spawnCmd('ls', config)
// Pass in a directory to run the command from as the third argument
const config = { args: [ '-la' ] cwd: __dirname }
await spawnCmd('ls', config, path.join(__dirname, '../'))
defaultSettings = {
gid: process.getgid(),
uid: process.getuid(),
env: process.env,
cwd: rootDir, // Project root directory, NOT spawn-cmd directory
stdio: 'inherit',
}
asyncCmd
child_process.exec const { asyncCmd } = require('@keg-hub/spawn-cmd')
;(()=>{
const { error, data, exitCode } = await asyncCmd('echo test')
// String output of stderr
console.log(error)
// String output of stdout
console.log(data)
// Numbered exit code from the command
// 0 === success, anything else is exit from error
console.log(exitCode)
})()
FAQs
Cross platform child_process execution in Node
The npm package @keg-hub/spawn-cmd receives a total of 1,206 weekly downloads. As such, @keg-hub/spawn-cmd popularity was classified as popular.
We found that @keg-hub/spawn-cmd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.