| ... | ... | @@ -433,7 +433,7 @@ pub const ChildProcess = struct { |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | fn spawnWindows(self: &ChildProcess) -> %void { |
| 436 | | var saAttr = windows.SECURITY_ATTRIBUTES { |
| 436 | const saAttr = windows.SECURITY_ATTRIBUTES { |
| 437 | 437 | .nLength = @sizeOf(windows.SECURITY_ATTRIBUTES), |
| 438 | 438 | .bInheritHandle = windows.TRUE, |
| 439 | 439 | .lpSecurityDescriptor = null, |
| ... | ... | @@ -459,7 +459,7 @@ pub const ChildProcess = struct { |
| 459 | 459 | var g_hChildStd_IN_Wr: ?windows.HANDLE = null; |
| 460 | 460 | switch (self.stdin_behavior) { |
| 461 | 461 | StdIo.Pipe => { |
| 462 | | %return windowsMakePipeIn(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr); |
| 462 | %return windowsMakePipeIn(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, saAttr); |
| 463 | 463 | }, |
| 464 | 464 | StdIo.Ignore => { |
| 465 | 465 | g_hChildStd_IN_Rd = nul_handle; |
| ... | ... | @@ -477,7 +477,7 @@ pub const ChildProcess = struct { |
| 477 | 477 | var g_hChildStd_OUT_Wr: ?windows.HANDLE = null; |
| 478 | 478 | switch (self.stdout_behavior) { |
| 479 | 479 | StdIo.Pipe => { |
| 480 | | %return windowsMakePipeOut(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr); |
| 480 | %return windowsMakePipeOut(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, saAttr); |
| 481 | 481 | }, |
| 482 | 482 | StdIo.Ignore => { |
| 483 | 483 | g_hChildStd_OUT_Wr = nul_handle; |
| ... | ... | @@ -495,7 +495,7 @@ pub const ChildProcess = struct { |
| 495 | 495 | var g_hChildStd_ERR_Wr: ?windows.HANDLE = null; |
| 496 | 496 | switch (self.stderr_behavior) { |
| 497 | 497 | StdIo.Pipe => { |
| 498 | | %return windowsMakePipeOut(&g_hChildStd_ERR_Rd, &g_hChildStd_ERR_Wr, &saAttr); |
| 498 | %return windowsMakePipeOut(&g_hChildStd_ERR_Rd, &g_hChildStd_ERR_Wr, saAttr); |
| 499 | 499 | }, |
| 500 | 500 | StdIo.Ignore => { |
| 501 | 501 | g_hChildStd_ERR_Wr = nul_handle; |
| ... | ... | @@ -675,7 +675,12 @@ fn windowsDestroyPipe(rd: ?windows.HANDLE, wr: ?windows.HANDLE) { |
| 675 | 675 | if (wr) |h| os.windowsClose(h); |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | | fn windowsMakePipe(rd: &windows.HANDLE, wr: &windows.HANDLE, sattr: &windows.SECURITY_ATTRIBUTES) -> %void { |
| 678 | |
| 679 | // TODO: workaround for bug where the `const` from `&const` is dropped when the type is |
| 680 | // a namespace field lookup |
| 681 | const SECURITY_ATTRIBUTES = windows.SECURITY_ATTRIBUTES; |
| 682 | |
| 683 | fn windowsMakePipe(rd: &windows.HANDLE, wr: &windows.HANDLE, sattr: &const SECURITY_ATTRIBUTES) -> %void { |
| 679 | 684 | if (windows.CreatePipe(rd, wr, sattr, 0) == 0) { |
| 680 | 685 | const err = windows.GetLastError(); |
| 681 | 686 | return switch (err) { |
| ... | ... | @@ -693,19 +698,21 @@ fn windowsSetHandleInfo(h: windows.HANDLE, mask: windows.DWORD, flags: windows.D |
| 693 | 698 | } |
| 694 | 699 | } |
| 695 | 700 | |
| 696 | | fn windowsMakePipeIn(rd: &?windows.HANDLE, wr: &?windows.HANDLE, sattr: &windows.SECURITY_ATTRIBUTES) -> %void { |
| 701 | fn windowsMakePipeIn(rd: &?windows.HANDLE, wr: &?windows.HANDLE, sattr: &const SECURITY_ATTRIBUTES) -> %void { |
| 697 | 702 | var rd_h: windows.HANDLE = undefined; |
| 698 | 703 | var wr_h: windows.HANDLE = undefined; |
| 699 | 704 | %return windowsMakePipe(&rd_h, &wr_h, sattr); |
| 705 | %defer windowsDestroyPipe(rd_h, wr_h); |
| 700 | 706 | %return windowsSetHandleInfo(wr_h, windows.HANDLE_FLAG_INHERIT, 0); |
| 701 | 707 | *rd = rd_h; |
| 702 | 708 | *wr = wr_h; |
| 703 | 709 | } |
| 704 | 710 | |
| 705 | | fn windowsMakePipeOut(rd: &?windows.HANDLE, wr: &?windows.HANDLE, sattr: &windows.SECURITY_ATTRIBUTES) -> %void { |
| 711 | fn windowsMakePipeOut(rd: &?windows.HANDLE, wr: &?windows.HANDLE, sattr: &const SECURITY_ATTRIBUTES) -> %void { |
| 706 | 712 | var rd_h: windows.HANDLE = undefined; |
| 707 | 713 | var wr_h: windows.HANDLE = undefined; |
| 708 | 714 | %return windowsMakePipe(&rd_h, &wr_h, sattr); |
| 715 | %defer windowsDestroyPipe(rd_h, wr_h); |
| 709 | 716 | %return windowsSetHandleInfo(rd_h, windows.HANDLE_FLAG_INHERIT, 0); |
| 710 | 717 | *rd = rd_h; |
| 711 | 718 | *wr = wr_h; |