1.1.2 • Published 6 years ago
pour-console v1.1.2
pour-console
A simplified promise-based spawn, with real-time logging to console.
Usage
const { pour } = require('pour-console');
(async () => {
await pour('git switch "non-existent branch"')
await pour('echo "does not reach here"') // Will not reach here.
})().catch(console.error)Deviation from spawn
This project uses shlex to simplify command calling; however you can directly use it without shlex by
await pour([
'git',
'commit',
'-m',
'long Long commit message'
])As this also inherits spawn, you can specify cwd by
await pour('git add .', {
cwd: './dist'
})Special apps and apps that need Ctrl key
In this case, you'll need to use the good ol' stdio: "inherit".
await pour('nano file.txt', {
stdio: 'inherit'
})Installation
yarn add pour-console # or npm i pour-consoleAbout the name
The name comes from a different package -- std-pour, with quite a similar functionality. But this package is enhanced.