diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-10-21 13:55:26 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-10-29 06:20:51 -0700 |
| commit | 00a3123fbe79d9bb74b2c877130579299d2ba5ba (patch) | |
| tree | d4a5b531f5d255abe903e3e0c7cb565a0a2245c0 /lib/std/process | |
| parent | ab003cd0545e54e66410b8e67136d4ef079b3198 (diff) | |
| download | zig-00a3123fbe79d9bb74b2c877130579299d2ba5ba.tar.gz zig-00a3123fbe79d9bb74b2c877130579299d2ba5ba.zip | |
std.process.Child: update for std.Io changes
Diffstat (limited to 'lib/std/process')
| -rw-r--r-- | lib/std/process/Child.zig | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/std/process/Child.zig b/lib/std/process/Child.zig index 7ca919ca46..e49c5c4532 100644 --- a/lib/std/process/Child.zig +++ b/lib/std/process/Child.zig @@ -1084,16 +1084,24 @@ fn windowsCreateProcessPathExt( // or a version with a supported PATHEXT appended. We then try calling CreateProcessW // with the found versions in the appropriate order. + // In the future, child process execution needs to move to Io implementation. + // Under those conditions, here we will have access to lower level directory + // opening function knowing which implementation we are in. Here, we imitate + // that scenario. + var threaded: std.Io.Threaded = .init_single_threaded; + const io = threaded.io(); + var dir = dir: { // needs to be null-terminated try dir_buf.append(allocator, 0); defer dir_buf.shrinkRetainingCapacity(dir_path_len); const dir_path_z = dir_buf.items[0 .. dir_buf.items.len - 1 :0]; const prefixed_path = try windows.wToPrefixedFileW(null, dir_path_z); - break :dir fs.cwd().openDirW(prefixed_path.span().ptr, .{ .iterate = true }) catch - return error.FileNotFound; + break :dir threaded.dirOpenDirWindows(.cwd(), prefixed_path.span(), .{ + .iterate = true, + }) catch return error.FileNotFound; }; - defer dir.close(); + defer dir.close(io); // Add wildcard and null-terminator try app_buf.append(allocator, '*'); @@ -1127,7 +1135,7 @@ fn windowsCreateProcessPathExt( .Buffer = @constCast(app_name_wildcard.ptr), }; const rc = windows.ntdll.NtQueryDirectoryFile( - dir.fd, + dir.handle, null, null, null, |
