| ... | @@ -217,11 +217,11 @@ pub const ChildProcess = struct { | ... | @@ -217,11 +217,11 @@ pub const ChildProcess = struct { |
| 217 | } | 217 | } |
| 218 | | 218 | |
| 219 | fn waitUnwrappedWindows(self: *ChildProcess) !void { | 219 | fn waitUnwrappedWindows(self: *ChildProcess) !void { |
| 220 | const result = os.windowsWaitSingle(self.handle, windows.INFINITE); | 220 | const result = windows.WaitForSingleObject(self.handle, windows.INFINITE); |
| 221 | | 221 | |
| 222 | self.term = (SpawnError!Term)(x: { | 222 | self.term = (SpawnError!Term)(x: { |
| 223 | var exit_code: windows.DWORD = undefined; | 223 | var exit_code: windows.DWORD = undefined; |
| 224 | if (windows.GetExitCodeProcess(self.handle, &exit_code) == 0) { | 224 | if (windows.kernel32.GetExitCodeProcess(self.handle, &exit_code) == 0) { |
| 225 | break :x Term{ .Unknown = 0 }; | 225 | break :x Term{ .Unknown = 0 }; |
| 226 | } else { | 226 | } else { |
| 227 | break :x Term{ .Exited = exit_code }; | 227 | break :x Term{ .Exited = exit_code }; |
| ... | @@ -412,7 +412,7 @@ pub const ChildProcess = struct { | ... | @@ -412,7 +412,7 @@ pub const ChildProcess = struct { |
| 412 | const any_ignore = (self.stdin_behavior == StdIo.Ignore or self.stdout_behavior == StdIo.Ignore or self.stderr_behavior == StdIo.Ignore); | 412 | const any_ignore = (self.stdin_behavior == StdIo.Ignore or self.stdout_behavior == StdIo.Ignore or self.stderr_behavior == StdIo.Ignore); |
| 413 | | 413 | |
| 414 | const nul_handle = if (any_ignore) blk: { | 414 | const nul_handle = if (any_ignore) blk: { |
| 415 | break :blk try os.windowsOpen("NUL", windows.GENERIC_READ, windows.FILE_SHARE_READ, windows.OPEN_EXISTING, windows.FILE_ATTRIBUTE_NORMAL); | 415 | break :blk try windows.CreateFile("NUL", windows.GENERIC_READ, windows.FILE_SHARE_READ, windows.OPEN_EXISTING, windows.FILE_ATTRIBUTE_NORMAL); |
| 416 | } else blk: { | 416 | } else blk: { |
| 417 | break :blk undefined; | 417 | break :blk undefined; |
| 418 | }; | 418 | }; |
| ... | @@ -420,7 +420,7 @@ pub const ChildProcess = struct { | ... | @@ -420,7 +420,7 @@ pub const ChildProcess = struct { |
| 420 | if (any_ignore) os.close(nul_handle); | 420 | if (any_ignore) os.close(nul_handle); |
| 421 | } | 421 | } |
| 422 | if (any_ignore) { | 422 | if (any_ignore) { |
| 423 | try windowsSetHandleInfo(nul_handle, windows.HANDLE_FLAG_INHERIT, 0); | 423 | try windows.SetHandleInformation(nul_handle, windows.HANDLE_FLAG_INHERIT, 0); |
| 424 | } | 424 | } |
| 425 | | 425 | |
| 426 | var g_hChildStd_IN_Rd: ?windows.HANDLE = null; | 426 | var g_hChildStd_IN_Rd: ?windows.HANDLE = null; |
| ... | @@ -433,7 +433,7 @@ pub const ChildProcess = struct { | ... | @@ -433,7 +433,7 @@ pub const ChildProcess = struct { |
| 433 | g_hChildStd_IN_Rd = nul_handle; | 433 | g_hChildStd_IN_Rd = nul_handle; |
| 434 | }, | 434 | }, |
| 435 | StdIo.Inherit => { | 435 | StdIo.Inherit => { |
| 436 | g_hChildStd_IN_Rd = windows.GetStdHandle(windows.STD_INPUT_HANDLE); | 436 | g_hChildStd_IN_Rd = windows.GetStdHandle(windows.STD_INPUT_HANDLE) catch null; |
| 437 | }, | 437 | }, |
| 438 | StdIo.Close => { | 438 | StdIo.Close => { |
| 439 | g_hChildStd_IN_Rd = null; | 439 | g_hChildStd_IN_Rd = null; |
| ... | @@ -453,7 +453,7 @@ pub const ChildProcess = struct { | ... | @@ -453,7 +453,7 @@ pub const ChildProcess = struct { |
| 453 | g_hChildStd_OUT_Wr = nul_handle; | 453 | g_hChildStd_OUT_Wr = nul_handle; |
| 454 | }, | 454 | }, |
| 455 | StdIo.Inherit => { | 455 | StdIo.Inherit => { |
| 456 | g_hChildStd_OUT_Wr = windows.GetStdHandle(windows.STD_OUTPUT_HANDLE); | 456 | g_hChildStd_OUT_Wr = windows.GetStdHandle(windows.STD_OUTPUT_HANDLE) catch null; |
| 457 | }, | 457 | }, |
| 458 | StdIo.Close => { | 458 | StdIo.Close => { |
| 459 | g_hChildStd_OUT_Wr = null; | 459 | g_hChildStd_OUT_Wr = null; |
| ... | @@ -473,7 +473,7 @@ pub const ChildProcess = struct { | ... | @@ -473,7 +473,7 @@ pub const ChildProcess = struct { |
| 473 | g_hChildStd_ERR_Wr = nul_handle; | 473 | g_hChildStd_ERR_Wr = nul_handle; |
| 474 | }, | 474 | }, |
| 475 | StdIo.Inherit => { | 475 | StdIo.Inherit => { |
| 476 | g_hChildStd_ERR_Wr = windows.GetStdHandle(windows.STD_ERROR_HANDLE); | 476 | g_hChildStd_ERR_Wr = windows.GetStdHandle(windows.STD_ERROR_HANDLE) catch null; |
| 477 | }, | 477 | }, |
| 478 | StdIo.Close => { | 478 | StdIo.Close => { |
| 479 | g_hChildStd_ERR_Wr = null; | 479 | g_hChildStd_ERR_Wr = null; |
| ... | @@ -681,22 +681,22 @@ fn windowsDestroyPipe(rd: ?windows.HANDLE, wr: ?windows.HANDLE) void { | ... | @@ -681,22 +681,22 @@ fn windowsDestroyPipe(rd: ?windows.HANDLE, wr: ?windows.HANDLE) void { |
| 681 | if (wr) |h| os.close(h); | 681 | if (wr) |h| os.close(h); |
| 682 | } | 682 | } |
| 683 | | 683 | |
| 684 | fn windowsMakePipeIn(rd: *?windows.HANDLE, wr: *?windows.HANDLE, sattr: *const SECURITY_ATTRIBUTES) !void { | 684 | fn windowsMakePipeIn(rd: *?windows.HANDLE, wr: *?windows.HANDLE, sattr: *const windows.SECURITY_ATTRIBUTES) !void { |
| 685 | var rd_h: windows.HANDLE = undefined; | 685 | var rd_h: windows.HANDLE = undefined; |
| 686 | var wr_h: windows.HANDLE = undefined; | 686 | var wr_h: windows.HANDLE = undefined; |
| 687 | try windows.CreatePipe(&rd_h, &wr_h, sattr); | 687 | try windows.CreatePipe(&rd_h, &wr_h, sattr); |
| 688 | errdefer windowsDestroyPipe(rd_h, wr_h); | 688 | errdefer windowsDestroyPipe(rd_h, wr_h); |
| 689 | try windowsSetHandleInfo(wr_h, windows.HANDLE_FLAG_INHERIT, 0); | 689 | try windows.SetHandleInformation(wr_h, windows.HANDLE_FLAG_INHERIT, 0); |
| 690 | rd.* = rd_h; | 690 | rd.* = rd_h; |
| 691 | wr.* = wr_h; | 691 | wr.* = wr_h; |
| 692 | } | 692 | } |
| 693 | | 693 | |
| 694 | fn windowsMakePipeOut(rd: *?windows.HANDLE, wr: *?windows.HANDLE, sattr: *const SECURITY_ATTRIBUTES) !void { | 694 | fn windowsMakePipeOut(rd: *?windows.HANDLE, wr: *?windows.HANDLE, sattr: *const windows.SECURITY_ATTRIBUTES) !void { |
| 695 | var rd_h: windows.HANDLE = undefined; | 695 | var rd_h: windows.HANDLE = undefined; |
| 696 | var wr_h: windows.HANDLE = undefined; | 696 | var wr_h: windows.HANDLE = undefined; |
| 697 | try windows.CreatePipe(&rd_h, &wr_h, sattr); | 697 | try windows.CreatePipe(&rd_h, &wr_h, sattr); |
| 698 | errdefer windowsDestroyPipe(rd_h, wr_h); | 698 | errdefer windowsDestroyPipe(rd_h, wr_h); |
| 699 | try windowsSetHandleInfo(rd_h, windows.HANDLE_FLAG_INHERIT, 0); | 699 | try windows.SetHandleInformation(rd_h, windows.HANDLE_FLAG_INHERIT, 0); |
| 700 | rd.* = rd_h; | 700 | rd.* = rd_h; |
| 701 | wr.* = wr_h; | 701 | wr.* = wr_h; |
| 702 | } | 702 | } |