Skip to content

Commit 5772f92

Browse files
committed
windowsMakeAsyncPipe requires ?HANDLE = ?*anyopaque
1 parent cb9a3ac commit 5772f92

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/standalone/childprocess_extrapipe/parent.zig

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn main() !void {
4747
const child_path = it.next() orelse unreachable;
4848

4949
// use posix convention: 0 read, 1 write
50-
var pipe: if (builtin.os.tag == .windows) [2]windows.HANDLE else [2]os.fd_t = undefined;
50+
var pipe: if (builtin.os.tag == .windows) [2]?windows.HANDLE else [2]os.fd_t = undefined;
5151
if (builtin.os.tag == .windows) {
5252
const saAttr = windows.SECURITY_ATTRIBUTES{
5353
.nLength = @sizeOf(windows.SECURITY_ATTRIBUTES),
@@ -72,15 +72,20 @@ pub fn main() !void {
7272
gpa,
7373
);
7474
{
75+
// close read side of pipe
7576
if (comptime builtin.target.isDarwin()) {
7677
{
7778
child_proc.posix_actions = try os.posix_spawn.Actions.init();
7879
errdefer os.posix_actions.Attr.deinit();
79-
try child_proc.posix_actions.close(pipe[0]); // close read side of pipe
80+
try child_proc.posix_actions.close(pipe[0]);
8081
}
8182
}
8283
defer if (comptime !builtin.target.isDarwin()) {
83-
os.close(pipe[0]); // close read side of pipe
84+
if (builtin.os.tag == .windows) {
85+
os.close(pipe[0].?);
86+
} else {
87+
os.close(pipe[0]);
88+
}
8489
};
8590

8691
try child_proc.spawn();

0 commit comments

Comments
 (0)