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.
This commit is contained in:
Alistair Smith
2026-01-05 18:37:51 +00:00
committed by Claude
parent 856eda2f24
commit f188b9352f
2 changed files with 3 additions and 3 deletions

View File

@@ -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 {};
}

View File

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