1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 04:52:26 -05:00

fix and add test

This commit is contained in:
yazan-abdalrahman 2024-09-24 17:28:50 +03:00
parent d82f4f32e5
commit fd38dbab3d
2 changed files with 22 additions and 0 deletions

View file

@ -1057,6 +1057,8 @@ pub fn open_with_access_check(
let is_windows_device_path = cfg!(windows)
&& (path_bytes.starts_with(br"\\.\")
|| path_bytes.starts_with(b"//./")
|| path_bytes.starts_with(b"//?/")
|| path_bytes.starts_with(br"\\?\")
|| path_bytes.ends_with(b"$"))
&& !path_bytes.contains(&b':');
let path = if is_windows_device_path {

View file

@ -21,6 +21,26 @@
"args": "eval console.log({isTTY:Deno.openSync('//./CONIN$',{read:true,write:true}).isTerminal()})",
"output": "{ isTTY: true }\n"
},
"valid_device_paths_with_prefix_ii": {
"if": "windows",
"args": "eval console.log({isTTY:Deno.openSync('//?/CONIN$',{read:true,write:true}).isTerminal()})",
"output": "{ isTTY: true }\n"
},
"valid_device_paths_with_prefix_iii": {
"if": "windows",
"args": "eval console.log({isTTY:Deno.openSync('//?/CONOUT$',{read:true,write:true}).isTerminal()})",
"output": "{ isTTY: true }\n"
},
"valid_device_paths_nul_i": {
"if": "windows",
"args": "eval console.log({isTTY:Deno.openSync('//./NUL',{read:true,write:true}).isTerminal()})",
"output": "{ isTTY: false }\n"
},
"valid_device_paths_nul_ii": {
"if": "windows",
"args": "eval console.log({isTTY:Deno.openSync('//?/NUL',{read:true,write:true}).isTerminal()})",
"output": "{ isTTY: false }\n"
},
"invalid_device_paths": {
"if": "windows",
"args": "eval console.log({isTTY:Deno.openSync('\\\\.\\INVALID$',{read:true,write:true}).isTerminal()})",