Skip to content

Commit a0275a7

Browse files
committed
fix windows async pipe creation
1 parent 548547d commit a0275a7

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

lib/std/child_process.zig

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,6 @@ pub const ChildProcess = struct {
899899
&tmp_hChildStd_Rd,
900900
&tmp_hChildStd_Wr,
901901
&saAttr,
902-
PipeDirection.child_to_parent,
903902
);
904903
g_hChildStd_OUT_Rd = tmp_hChildStd_Rd;
905904
g_hChildStd_OUT_Wr = tmp_hChildStd_Wr;
@@ -926,7 +925,6 @@ pub const ChildProcess = struct {
926925
&tmp_hChildStd_Rd,
927926
&tmp_hChildStd_Wr,
928927
&saAttr,
929-
PipeDirection.child_to_parent,
930928
);
931929
g_hChildStd_ERR_Rd = tmp_hChildStd_Rd;
932930
g_hChildStd_ERR_Wr = tmp_hChildStd_Wr;
@@ -1133,7 +1131,7 @@ pub const ChildProcess = struct {
11331131
const PortPipeReturn = if (builtin.os.tag == .windows) [2]windows.HANDLE else [2]os.fd_t;
11341132

11351133
/// Portable pipe creation without handle inheritance
1136-
pub fn portablePipe() !PortPipeReturn {
1134+
pub inline fn portablePipe() !PortPipeReturn {
11371135
// TODO think how to offer user an interface to lpSecurityDescriptor
11381136
var pipe_new: PortPipeReturn = undefined;
11391137
if (builtin.os.tag == .windows) {
@@ -1529,7 +1527,6 @@ pub fn windowsMakeAsyncPipe(
15291527
rd: *windows.HANDLE,
15301528
wr: *windows.HANDLE,
15311529
sattr: *const windows.SECURITY_ATTRIBUTES,
1532-
direction: ChildProcess.PipeDirection,
15331530
) !void {
15341531
var tmp_bufw: [128]u16 = undefined;
15351532

@@ -1585,10 +1582,6 @@ pub fn windowsMakeAsyncPipe(
15851582
}
15861583
errdefer os.close(write_handle);
15871584

1588-
switch (direction) {
1589-
.child_to_parent => try windows.SetHandleInformation(read_handle, windows.HANDLE_FLAG_INHERIT, windows.HANDLE_FLAG_INHERIT),
1590-
.parent_to_child => try windows.SetHandleInformation(write_handle, windows.HANDLE_FLAG_INHERIT, windows.HANDLE_FLAG_INHERIT),
1591-
}
15921585
rd.* = read_handle;
15931586
wr.* = write_handle;
15941587
}

test/standalone/childprocess_extrapipe/parent.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn main() !void {
2929
gpa,
3030
);
3131

32-
// enabling of file inheritance directly before and directly after spawn
32+
// enabling of file inheritance directly before and closing directly after spawn
3333
// less time to leak => better
3434
{
3535
if (os.hasPosixSpawn) child_proc.posix_actions = try os.posix_spawn.Actions.init();

0 commit comments

Comments
 (0)