mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
* fix: emit close on stdin stream end We where not emitting the `close` event when done reading stdin data. It took me way too long to find this but i kept searching in zig/cpp code of the stream implementations... Fixes: https://github.com/oven-sh/bun/issues/6713 * fix: don't emit close twice
12 lines
369 B
JavaScript
12 lines
369 B
JavaScript
process.stdin.setEncoding("utf8");
|
|
process.stdin.on("data", data => {
|
|
process.stdout.write(data);
|
|
});
|
|
process.stdin.once(process.argv[2] == "close-event" ? "close" : "end", () => {
|
|
process.stdout.write(process.argv[2] == "close-event" ? "ENDED-CLOSE" : "ENDED");
|
|
});
|
|
if (process.argv[2] == "resume") {
|
|
process.stdout.write("RESUMED");
|
|
process.stdin.resume();
|
|
}
|