From f188b9352f360a4a47b4a8fd58eec779fd107f4e Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Mon, 5 Jan 2026 18:37:51 +0000 Subject: [PATCH] fix: match Node.js error message for _debugProcess on Windows Use the same error message as Node.js ('The system cannot find the file specified.') when the debug handler file mapping doesn't exist, for compatibility with existing Node.js tests. --- src/bun.js/bindings/BunProcess.cpp | 3 ++- test/js/node/test/parallel/test-debug-process.js | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bun.js/bindings/BunProcess.cpp b/src/bun.js/bindings/BunProcess.cpp index 64e864166e..f87ce12c77 100644 --- a/src/bun.js/bindings/BunProcess.cpp +++ b/src/bun.js/bindings/BunProcess.cpp @@ -3870,7 +3870,8 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionDebugProcess, (JSC::JSGlobalObject * gl HANDLE hMapping = OpenFileMappingW(FILE_MAP_READ, FALSE, mappingName); if (!hMapping) { - throwVMError(globalObject, scope, makeString("Failed to open debug handler for process "_s, pid, ": process may not have inspector support enabled"_s)); + // Match Node.js error message for compatibility + throwVMError(globalObject, scope, "The system cannot find the file specified."_s); return {}; } diff --git a/test/js/node/test/parallel/test-debug-process.js b/test/js/node/test/parallel/test-debug-process.js index e9edbd2955..0d10a15e2e 100644 --- a/test/js/node/test/parallel/test-debug-process.js +++ b/test/js/node/test/parallel/test-debug-process.js @@ -16,7 +16,6 @@ cp.on('exit', common.mustCall(function() { try { process._debugProcess(cp.pid); } catch (error) { - // Bun uses a file mapping mechanism for _debugProcess, so the error message differs from Node.js - assert.match(error.message, /Failed to open debug handler for process \d+/); + assert.strictEqual(error.message, 'The system cannot find the file specified.'); } }));