Skip to content

Commit dd44915

Browse files
committed
fix: guard node-pty conpty AttachConsole failure on node 24 (windows e2e)
Add a patch-package patch for node-pty@1.1.0 that wraps the getConsoleProcessList(shellPid) call in conpty_console_list_agent.js in a try/catch. Under Node v24 on Windows, the forked ConPTY console list agent calls the native getConsoleProcessList, which invokes Win32 AttachConsole and can throw "AttachConsole failed" during PTY teardown. The uncaught throw destabilizes the PTY so the nexpect harness can no longer answer interactive prompts, causing e2e Windows shards (e.g. geo_multi_env_searchable_datastore) to hang until the 1200s no-output kill. The guard falls back to [shellPid] on failure so the agent still sends a valid console process list and exits 0, letting the parent kill() proceed cleanly. --- Prompt: Add a patch-package patch that fixes the Node 24 / Windows ConPTY `AttachConsole failed` crash in node-pty, on the node24 branch, and push it.
1 parent 70a55d2 commit dd44915

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

patches/node-pty+1.1.0.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/node_modules/node-pty/lib/conpty_console_list_agent.js b/node_modules/node-pty/lib/conpty_console_list_agent.js
2+
index 8c4fca9..afeedf8 100644
3+
--- a/node_modules/node-pty/lib/conpty_console_list_agent.js
4+
+++ b/node_modules/node-pty/lib/conpty_console_list_agent.js
5+
@@ -10,7 +10,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6+
var utils_1 = require("./utils");
7+
var getConsoleProcessList = utils_1.loadNativeModule('conpty_console_list').module.getConsoleProcessList;
8+
var shellPid = parseInt(process.argv[2], 10);
9+
-var consoleProcessList = getConsoleProcessList(shellPid);
10+
+var consoleProcessList;
11+
+try {
12+
+ consoleProcessList = getConsoleProcessList(shellPid);
13+
+}
14+
+catch (e) {
15+
+ // Node 24 + Windows ConPTY: AttachConsole can fail during PTY teardown.
16+
+ // Fall back to the shell PID so the parent kill() proceeds cleanly.
17+
+ consoleProcessList = [shellPid];
18+
+}
19+
process.send({ consoleProcessList: consoleProcessList });
20+
process.exit(0);
21+
//# sourceMappingURL=conpty_console_list_agent.js.map
22+
\ No newline at end of file

0 commit comments

Comments
 (0)