Skip to content

Commit

Permalink
fix: 🐛 avoid to write in closed stream
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Oct 12, 2023
1 parent 8e74dfc commit 27df67a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export default class Engine extends SafeTransform {
debug('ezs')(`Ignoring error at item #${currentIndex}`);
return this.push(createErrorWith(data, currentIndex, this.funcName, chunk));
}
return this.push(data);
if (!this.errorWasSent) {
return this.push(data);
}
};
const wait = async () => {
this.pause();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/statements/fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export default function fork(data, feed) {
this.whenFinish = new Promise((resolve) => output
.pipe(ezs.catch((e) => feed.write(e))) // avoid to break pipeline at each error
.once('error', (e) => feed.stop(e))
.once('end', resolve)
.on('data', () => true)
.once('end', resolve)
);
}
}
Expand Down

0 comments on commit 27df67a

Please sign in to comment.