mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
fix(cli/ops/net): add write permissions for unixpackets datagrams & unix socket (#8511)
Fixes #7781
This commit is contained in:
parent
ff3c5897ea
commit
59f10b3604
2 changed files with 40 additions and 1 deletions
|
@ -65,6 +65,44 @@ unitTest(
|
|||
},
|
||||
);
|
||||
|
||||
unitTest(
|
||||
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
||||
function netUnixListenWritePermission(): void {
|
||||
try {
|
||||
const filePath = Deno.makeTempFileSync();
|
||||
const socket = Deno.listen({
|
||||
path: filePath,
|
||||
transport: "unix",
|
||||
});
|
||||
assert(socket.addr.transport === "unix");
|
||||
assertEquals(socket.addr.path, filePath);
|
||||
socket.close();
|
||||
} catch (e) {
|
||||
assert(!!e);
|
||||
assert(e instanceof Deno.errors.PermissionDenied);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
unitTest(
|
||||
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
||||
function netUnixPacketListenWritePermission(): void {
|
||||
try {
|
||||
const filePath = Deno.makeTempFileSync();
|
||||
const socket = Deno.listenDatagram({
|
||||
path: filePath,
|
||||
transport: "unixpacket",
|
||||
});
|
||||
assert(socket.addr.transport === "unixpacket");
|
||||
assertEquals(socket.addr.path, filePath);
|
||||
socket.close();
|
||||
} catch (e) {
|
||||
assert(!!e);
|
||||
assert(e instanceof Deno.errors.PermissionDenied);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
unitTest(
|
||||
{
|
||||
perms: { net: true },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue