mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
this test is supposed to be allowed to fail with either message
This commit is contained in:
@@ -269,12 +269,13 @@ JSC::JSValue createSystemError(JSC::JSGlobalObject* global, ASCIILiteral message
|
||||
|
||||
JSC::JSValue createSystemError(JSC::JSGlobalObject* global, ASCIILiteral syscall, int err)
|
||||
{
|
||||
auto* instance = JSC::createError(global, makeString(String(syscall), "() failed: "_s, String::fromLatin1(strerror(err))));
|
||||
auto errstr = String::fromLatin1(errno_string(err));
|
||||
auto* instance = JSC::createError(global, makeString(String(syscall), "() failed: "_s, errstr, ": "_s, String::fromLatin1(strerror(err))));
|
||||
auto& vm = global->vm();
|
||||
auto& builtinNames = WebCore::builtinNames(vm);
|
||||
instance->putDirect(vm, builtinNames.syscallPublicName(), jsString(vm, String(syscall)), 0);
|
||||
instance->putDirect(vm, builtinNames.errnoPublicName(), JSC::jsNumber(err), 0);
|
||||
instance->putDirect(vm, vm.propertyNames->name, jsString(vm, String("SystemError"_s)), JSC::PropertyAttribute::DontEnum | 0);
|
||||
instance->putDirect(vm, builtinNames.codePublicName(), jsString(vm, String::fromLatin1(errno_string(err))));
|
||||
instance->putDirect(vm, builtinNames.codePublicName(), jsString(vm, errstr));
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -80,19 +80,9 @@ if (isWindows) {
|
||||
expect(() => process.getgid()).not.toThrow();
|
||||
expect(() => process.getuid()).not.toThrow();
|
||||
|
||||
expect(() => process.setgid("nobody")).toThrow(
|
||||
expect.objectContaining({
|
||||
syscall: "setgid",
|
||||
code: "EPERM",
|
||||
}),
|
||||
);
|
||||
expect(() => process.setgid("nobody")).toThrow(/EPERM|Group identifier does not exist/);
|
||||
|
||||
expect(() => process.setuid("nobody")).toThrow(
|
||||
expect.objectContaining({
|
||||
syscall: "setuid",
|
||||
code: "EPERM",
|
||||
}),
|
||||
);
|
||||
expect(() => process.setuid("nobody")).toThrow(/EPERM|User identifier does not exist/);
|
||||
});
|
||||
} else {
|
||||
test("root user permissions", async () => {
|
||||
|
||||
Reference in New Issue
Block a user