Skip to content
Myr

sequence.js

This file

Path

lib/pipe/sequence.js

24 lines · 950 bytes · JavaScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 7264bcf point at it.

Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343

lines 1–5why, one step back
1// Like Bash, we await both subprocesses. This is unlike some other shells which only await the destination subprocess.
2// Like Bash with the `pipefail` option, if either subprocess fails, the whole pipe fails.3// Like Bash, if both subprocesses fail, we return the failure of the destination.4// This ensures both subprocesses' errors are present, using `error.pipedFrom`.5export const waitForBothSubprocesses = async subprocessPromises => {

Print process completion with verbose option (#887)ehmickybefore adoption7264bcf

lines 6–8why, one step back
6 const [
7 {status: sourceStatus, reason: sourceReason, value: sourceResult = sourceReason},8 {status: destinationStatus, reason: destinationReason, value: destinationResult = destinationReason},

Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343

line 9why, one step back
9 ] = await subprocessPromises;

Print process completion with verbose option (#887)ehmickybefore adoption7264bcf

lines 10–24why, one step back
10
11 if (!destinationResult.pipedFrom.includes(sourceResult)) {12 destinationResult.pipedFrom.push(sourceResult);13 }1415 if (destinationStatus === 'rejected') {16 throw destinationResult;17 }1819 if (sourceStatus === 'rejected') {20 throw sourceResult;21 }2223 return destinationResult;24};