Skip to content

Commit

Permalink
Improve stream error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 15, 2019
1 parent ecde8d2 commit 4ceb0a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ const replaceResult = function({ file, input, opts }) {
}

const streamResult = function({ file, input, opts, opts: { from } }) {
const { [from]: result } = streamCommand(input, opts)
const execaResult = streamCommand(input, opts)
const { [from]: result } = execaResult

// Make stream fail if the command fails
execaResult.catch(error => result.emit('error', error))

// eslint-disable-next-line no-param-reassign, fp/no-mutation
file.contents = result
}
Expand Down

0 comments on commit 4ceb0a8

Please sign in to comment.