authorgravatar for 73941998+UtkarshUsername@users.noreply.github.comUtkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com> 2026-09-29 04:31:43+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-28 16:01:43-07:00
logb21f3b71913370a1a650a61fd9082f992d40e657
treee4d3ee4f4c241888c18e07ce719ad10915ac0555
parent7733bc839e23e19467a70b11a0bcedf6ffe8f1a3
signature Signed by PGP key B5690EEEBB952194

fix(server): prevent Windows PTY helper crashes in watch mode (#14179)


3 files changed, 39 insertions(+), 2 deletions(-)

patches/node-pty@1.2.0-beta.15.patch created+35
......@@ -0,0 +1,35 @@
1diff --git a/lib/windowsConoutConnection.js b/lib/windowsConoutConnection.js
2--- a/lib/windowsConoutConnection.js
3+++ b/lib/windowsConoutConnection.js
4@@ -63,7 +63,11 @@
5 conoutPipeName: _conoutPipeName
6 };
7 var scriptPath = __dirname.replace('node_modules.asar', 'node_modules.asar.unpacked');
8- this._worker = new worker_threads_1.Worker((0, path_1.join)(scriptPath, 'worker/conoutSocketWorker.js'), { workerData: workerData });
9+ // Node's watch mode reports dependencies through worker messages.
10+ // Keep the host's watch environment out of this protocol worker.
11+ var workerEnv = Object.assign({}, process.env);
12+ delete workerEnv.WATCH_REPORT_DEPENDENCIES;
13+ this._worker = new worker_threads_1.Worker((0, path_1.join)(scriptPath, 'worker/conoutSocketWorker.js'), { workerData: workerData, env: workerEnv, execArgv: [] });
14 this._worker.on('message', function (message) {
15 switch (message) {
16 case 1 /* ConoutWorkerMessage.READY */:
17diff --git a/lib/windowsPtyAgent.js b/lib/windowsPtyAgent.js
18--- a/lib/windowsPtyAgent.js
19+++ b/lib/windowsPtyAgent.js
20@@ -218,8 +218,14 @@
21 return Promise.resolve([]);
22 }
23 return new Promise(function (resolve) {
24- var agent = (0, child_process_1.fork)(path.join(__dirname, 'conpty_console_list_agent'), [_this._innerPid.toString()]);
25+ // Node's watch mode sends its own messages over the helper's IPC channel.
26+ var agentEnv = Object.assign({}, process.env);
27+ delete agentEnv.WATCH_REPORT_DEPENDENCIES;
28+ var agent = (0, child_process_1.fork)(path.join(__dirname, 'conpty_console_list_agent'), [_this._innerPid.toString()], { env: agentEnv, execArgv: [] });
29 agent.on('message', function (message) {
30+ if (!Array.isArray(message.consoleProcessList)) {
31+ return;
32+ }
33 clearTimeout(timeout);
34 resolve(message.consoleProcessList);
35 });
pnpm-lock.yaml+3-2
......@@ -107,6 +107,7 @@ patchedDependencies:
107107 expo-notifications@57.0.15: f89252c2c08dc7b3acb8415f319ebbe15fff8c9f88a64ebe1830cd5ac5c9ac40
108108 expo-sharing@57.0.17: 8d2e3b10eb3f52036a9a086800180ec6cebf3b75bccc5b1775117a7244d4ac45
109109 expo-widgets@57.0.15: 319a9ded5db49c5b5215c511a138b33f44c7ea2972eb418192e8d5342fe75ce6
110 node-pty@1.2.0-beta.15: f2fe901c61cde17986240002d05c172d5d0272d83ffaab8d0ebeb922763be414
110111 react-native-gesture-handler@2.32.0: 0579f8e4dad02bf3183d95b02620358412983c36f9bda7425dc8bcb9643b5ce2
111112 react-native-keyboard-controller@1.21.13: 6e4339347bc5bb3c9ea67d85ff5c814058b211c5750f247aba59d07869a2e787
112113 react-native-nitro-markdown@0.5.8: 642b47830730acff3761fe29cf54271d18b493c0070c750097850b7ea032e00c
......@@ -532,7 +533,7 @@ importers:
532533 version: 4.0.0-rc.115(patch_hash=0dfc4bb8ebd80fb3e06b91ef61346f5259517ab0f2437644fe95ae531084b1f5)
533534 node-pty:
534535 specifier: ^1.2.0-beta.15
535 version: 1.2.0-beta.15
536 version: 1.2.0-beta.15(patch_hash=f2fe901c61cde17986240002d05c172d5d0272d83ffaab8d0ebeb922763be414)
536537 stream-chain:
537538 specifier: ^4.2.5
538539 version: 4.2.5
......@@ -20110,7 +20111,7 @@ snapshots:
2011020111
2011120112 node-mock-http@1.0.5: {}
2011220113
20113 node-pty@1.2.0-beta.15:
20114 node-pty@1.2.0-beta.15(patch_hash=f2fe901c61cde17986240002d05c172d5d0272d83ffaab8d0ebeb922763be414):
2011420115 dependencies:
2011520116 node-addon-api: 7.1.1
2011620117
pnpm-workspace.yaml+1
......@@ -196,6 +196,7 @@ patchedDependencies:
196196 expo-notifications@57.0.15: patches/expo-notifications@57.0.15.patch
197197 expo-sharing@57.0.17: patches/expo-sharing@57.0.17.patch
198198 expo-widgets@57.0.15: patches/expo-widgets@57.0.15.patch
199 node-pty@1.2.0-beta.15: patches/node-pty@1.2.0-beta.15.patch
199200 react-native-gesture-handler@2.32.0: patches/react-native-gesture-handler@2.32.0.patch
200201 react-native-keyboard-controller@1.21.13: patches/react-native-keyboard-controller@1.21.13.patch
201202 react-native-nitro-modules@0.35.9: patches/react-native-nitro-modules@0.35.9.patch