Skip to content

Commit

Permalink
use feed.flow()
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Dec 13, 2020
1 parent 89b434b commit 675028c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/core/src/statements/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ export default function spawn(data, feed) {
statements = ezs.compileCommands(commands, this.getEnv());
}
const input = ezs.createStream(ezs.objectMode());
ezs.createPipeline(input, statements)
.pipe(ezs.catch((e) => feed.write(e))) // avoid to break pipeline at each error
.on('error', (e) => feed.stop(e))
.on('data', (d) => feed.write(d))
.on('end', () => feed.end());
ezs.writeTo(input, data, () => true);
return input.end();
const output = ezs.createPipeline(input, statements)
.pipe(ezs.catch((e) => feed.write(e))); // avoid to break pipeline at each error
ezs.writeTo(input, data, () => input.end());
return feed.flow(output);
}

0 comments on commit 675028c

Please sign in to comment.