(command, execArgs, execOpts, cmdDryRun)
| 40 | * @param {Boolean} [cmdDryRun] |
| 41 | */ |
| 42 | export function execAsyncPiped(command, execArgs, execOpts, cmdDryRun) { |
| 43 | if (cmdDryRun) { |
| 44 | console.log(`[DRY RUN] Would execute: ${command} ${execArgs.join(' ')}`); |
| 45 | return Promise.resolve({ stdout: '', stderr: '' }); |
| 46 | } |
| 47 | |
| 48 | const options = { |
| 49 | nodeOptions: { |
| 50 | ...execOpts, |
| 51 | stdio: ['pipe'], |
| 52 | } |
| 53 | }; |
| 54 | const spawned = spawnProcess(command, execArgs, options, cmdDryRun); |
| 55 | |
| 56 | return cmdDryRun ? Promise.resolve({ stdout: '', stderr: '' }) : wrapError(spawned); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Execute a command synchronously. |
no test coverage detected