aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-05-11 14:39:44 -0700
committerGravatar GitHub <noreply@github.com> 2023-05-11 14:39:44 -0700
commit02cad591f8c56f801fb9ccc480bf9547484144c2 (patch)
tree544dd92627fb4efd5d53842ce660f6e7a567efa3 /src
parent3530cfac68a616c88e4a7b19f5da29f79883c971 (diff)
downloadbun-02cad591f8c56f801fb9ccc480bf9547484144c2.tar.gz
bun-02cad591f8c56f801fb9ccc480bf9547484144c2.tar.zst
bun-02cad591f8c56f801fb9ccc480bf9547484144c2.zip
fix child process tests (#2584)
* always handle exit on next tick * emit spawn immediately
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/child_process.exports.js19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/bun.js/child_process.exports.js b/src/bun.js/child_process.exports.js
index 39f9380de..0ee72fe4c 100644
--- a/src/bun.js/child_process.exports.js
+++ b/src/bun.js/child_process.exports.js
@@ -1080,7 +1080,6 @@ export class ChildProcess extends EventEmitter {
this.#encoding = options.encoding || undefined;
this.#stdioOptions = bunStdio;
- var hasEmittedSpawn = false;
this.#handle = Bun.spawn({
cmd: spawnargs,
stdin: bunStdio[0],
@@ -1092,22 +1091,18 @@ export class ChildProcess extends EventEmitter {
this.#handle = handle;
this.pid = this.#handle.pid;
- if (!hasEmittedSpawn) {
- hasEmittedSpawn = true;
- process.nextTick(onSpawnNT, this);
- process.nextTick((exitCode, signalCode, err) => this.#handleOnExit(exitCode, signalCode, err));
- } else {
- this.#handleOnExit(exitCode, signalCode, err);
- }
+ process.nextTick(
+ (exitCode, signalCode, err) => this.#handleOnExit(exitCode, signalCode, err),
+ exitCode,
+ signalCode,
+ err,
+ );
},
lazy: true,
});
this.pid = this.#handle.pid;
- if (!hasEmittedSpawn) {
- process.nextTick(onSpawnNT, this);
- hasEmittedSpawn = true;
- }
+ onSpawnNT(this);
// const ipc = stdio.ipc;
// const ipcFd = stdio.ipcFd;