mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
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:
@@ -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 {};
|
||||
}
|
||||
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user