Skip to content

Commit 775fb07

Browse files
authored
Disconnect parent process IPC channel when child process disconnects (#4267)
In #3951, we added a [`finally` block](https://github.com/cloudflare/workers-sdk/blob/b5e62b931ad6671e4dce9444a279bb3ec8f63991/packages/wrangler/src/index.ts#L796-L802) to ensure that the wrangler CLI child process disconnects from the IPC channel connecting it to the parent process. Since the parent process forwards any messages it receives on the child IPC channel up to any higher-level IPC channel, we should follow suit and also disconnect any higher-level IPC channel as well.
1 parent 0cac2c4 commit 775fb07

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/wrangler/bin/wrangler.js

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
7676
if (process.send) {
7777
process.send(message);
7878
}
79+
})
80+
.on("disconnect", () => {
81+
if (process.disconnect) {
82+
process.disconnect();
83+
}
7984
});
8085
}
8186

0 commit comments

Comments
 (0)