Skip to content

Commit cd32992

Browse files
committed
fix: force stdio destroy on abort/child.kill()
1 parent 4d8a870 commit cd32992

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/main/ts/spawn.ts

+4
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ export const invoke = (c: TSpawnCtxNormalized): TSpawnCtxNormalized => {
251251
error = e
252252
c.ee.emit('err', error, c)
253253
})
254+
.once('exit', () => {
255+
child.stdout?.destroy()
256+
child.stderr?.destroy()
257+
})
254258
.once('close', (status, signal) => {
255259
c.fulfilled = {
256260
error,

target/cjs/spawn.cjs

+4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ var invoke = (c) => {
192192
child.once("error", (e) => {
193193
error = e;
194194
c.ee.emit("err", error, c);
195+
}).once("exit", () => {
196+
var _a3, _b3;
197+
(_a3 = child.stdout) == null ? void 0 : _a3.destroy();
198+
(_b3 = child.stderr) == null ? void 0 : _b3.destroy();
195199
}).once("close", (status, signal) => {
196200
var _a3;
197201
c.fulfilled = {

target/esm/spawn.mjs

+4
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ var invoke = (c) => {
171171
child.once("error", (e) => {
172172
error = e;
173173
c.ee.emit("err", error, c);
174+
}).once("exit", () => {
175+
var _a3, _b3;
176+
(_a3 = child.stdout) == null ? void 0 : _a3.destroy();
177+
(_b3 = child.stderr) == null ? void 0 : _b3.destroy();
174178
}).once("close", (status, signal) => {
175179
var _a3;
176180
c.fulfilled = {

0 commit comments

Comments
 (0)