Need private packages and team management tools?Check out npm Teams »

async-execute

1.2.0 • Public • Published

async-execute

🦅 Execute command in a child process

const execute = require('async-execute');
 
const commit_message = await execute('git log -1 --pretty=%B'); // Committed some changes

Options

Pipe stdout and stderr (default: false)

await execute('npm t', {pipe: true});

Exit process with child's exit code (default: false)

await execute('npm t', {pipe: true, exit: true});

Check a script exits properly

let code = 0;
 
try {
    const result = await execute('exit 2');
    code = result.code;
} catch (error) {
    code = error.code;
}
 
if (code > 0) {
    // something must have gone wrong
}

Install

npm i async-execute

DownloadsWeekly Downloads

2,545

Version

1.2.0

License

MIT

Unpacked Size

2.32 kB

Total Files

3

Last publish

Collaborators

  • avatar