snorun
v1.7.1
Published
Run & interact with shell command like in node without pain.
Downloads
45
Maintainers
Readme
snorun
Run and interact with shell commands in Node.js seamlessly.
Features
- Returns
trueif command exits with code 0,falseotherwise - Pipes stdin, stdout, and stderr with your main process
- Simple, intuitive API for shell command execution
Installation
npm install snorunUsage
Convert shell command chains to JavaScript:
Shell:
echo command && echo succ || echo failJavaScript:
import snorun from "snorun";
const result =
((await snorun("echo command")) && (await snorun("echo succ"))) ||
(await snorun("echo fail"));
// result = true
// Console output:
// > command
// > succAPI
snorun(command: string): Promise<boolean>
Executes a shell command and returns a promise that resolves to:
trueif the command exits with code 0falseotherwise
All output is piped to the parent process.
License
Author
snomiao - snomiao.com Email: [email protected]
Contributing
Issues and pull requests are welcome at github.com/snomiao/snorun
Support
If you find this project helpful, consider sponsoring!
