mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Return FileNotFound when CreateProcessW is called with a missing path (#23567)
This commit is contained in:
parent
530228d953
commit
ae38fc6a50
2 changed files with 3 additions and 0 deletions
|
|
@ -1980,6 +1980,7 @@ pub fn CreateProcessW(
|
||||||
switch (GetLastError()) {
|
switch (GetLastError()) {
|
||||||
.FILE_NOT_FOUND => return error.FileNotFound,
|
.FILE_NOT_FOUND => return error.FileNotFound,
|
||||||
.PATH_NOT_FOUND => return error.FileNotFound,
|
.PATH_NOT_FOUND => return error.FileNotFound,
|
||||||
|
.DIRECTORY => return error.FileNotFound,
|
||||||
.ACCESS_DENIED => return error.AccessDenied,
|
.ACCESS_DENIED => return error.AccessDenied,
|
||||||
.INVALID_PARAMETER => unreachable,
|
.INVALID_PARAMETER => unreachable,
|
||||||
.INVALID_NAME => return error.InvalidName,
|
.INVALID_NAME => return error.InvalidName,
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ pub fn main() anyerror!void {
|
||||||
try testExec(allocator, "HeLLo.exe", "hello from exe\n");
|
try testExec(allocator, "HeLLo.exe", "hello from exe\n");
|
||||||
// without extension should find the .exe (case insensitive)
|
// without extension should find the .exe (case insensitive)
|
||||||
try testExec(allocator, "heLLo", "hello from exe\n");
|
try testExec(allocator, "heLLo", "hello from exe\n");
|
||||||
|
// with invalid cwd
|
||||||
|
try std.testing.expectError(error.FileNotFound, testExecWithCwd(allocator, "hello.exe", "missing_dir", ""));
|
||||||
|
|
||||||
// now add a .bat
|
// now add a .bat
|
||||||
try tmp.dir.writeFile(.{ .sub_path = "hello.bat", .data = "@echo hello from bat" });
|
try tmp.dir.writeFile(.{ .sub_path = "hello.bat", .data = "@echo hello from bat" });
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue