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.'); } }));