From 7f4d471cba8336f89d937b0c791f88ec76a94313 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 22:27:40 +0000 Subject: [PATCH 1/5] Initial plan From 41eda9bbe75a42bb8bad59c21e274566aa335356 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 22:32:32 +0000 Subject: [PATCH 2/5] Define CLOSE_RANGE_CLOEXEC for Alpine compatibility Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com> --- src/unix/pty.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unix/pty.cc b/src/unix/pty.cc index a20bde53..3f3471f1 100644 --- a/src/unix/pty.cc +++ b/src/unix/pty.cc @@ -114,6 +114,11 @@ struct ExitEvent { #if defined(__linux__) +/* Define CLOSE_RANGE_CLOEXEC if not available (e.g., on Alpine/musl) */ +#ifndef CLOSE_RANGE_CLOEXEC +#define CLOSE_RANGE_CLOEXEC (1U << 2) +#endif + static int SetCloseOnExec(int fd) { int flags = fcntl(fd, F_GETFD, 0); From 4d2751d734ad2440cfe409b3ba114918dbee01cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 22:33:34 +0000 Subject: [PATCH 3/5] Final verification complete Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com> --- _codeql_detected_source_root | 1 + 1 file changed, 1 insertion(+) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file From d85b6372de830dfd979e09667aa60f1ed58335fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 22:34:13 +0000 Subject: [PATCH 4/5] Add CodeQL symlink to gitignore Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com> --- .gitignore | 1 + _codeql_detected_source_root | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 120000 _codeql_detected_source_root diff --git a/.gitignore b/.gitignore index 38ab6b10..7de13cd9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ fixtures/space folder/ .vscode/ipch/ yarn.lock prebuilds/ +_codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root deleted file mode 120000 index 945c9b46..00000000 --- a/_codeql_detected_source_root +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file From fd2eea6967a99b71955a82756a1af07316bcf93c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 22:43:49 +0000 Subject: [PATCH 5/5] Check for CLOSE_RANGE_CLOEXEC instead of defining it Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com> --- src/unix/pty.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/unix/pty.cc b/src/unix/pty.cc index 3f3471f1..9df942ef 100644 --- a/src/unix/pty.cc +++ b/src/unix/pty.cc @@ -114,11 +114,6 @@ struct ExitEvent { #if defined(__linux__) -/* Define CLOSE_RANGE_CLOEXEC if not available (e.g., on Alpine/musl) */ -#ifndef CLOSE_RANGE_CLOEXEC -#define CLOSE_RANGE_CLOEXEC (1U << 2) -#endif - static int SetCloseOnExec(int fd) { int flags = fcntl(fd, F_GETFD, 0); @@ -136,7 +131,7 @@ SetCloseOnExec(int fd) { static void pty_close_inherited_fds() { // Try close_range() first (Linux 5.9+, glibc 2.34+) - #if defined(SYS_close_range) + #if defined(SYS_close_range) && defined(CLOSE_RANGE_CLOEXEC) if (syscall(SYS_close_range, 3, ~0U, CLOSE_RANGE_CLOEXEC) == 0) { return; }