diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-29 01:57:06 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-29 01:57:06 -0500 |
| commit | 76176104001420ea04840f9b31e706289e4ebf11 (patch) | |
| tree | 4ba46044adc883630a3452b33f9d70541581d7ae /lib/std/child_process.zig | |
| parent | 1b41f2d77ea14de27b0655a35a727d664cfc4ca4 (diff) | |
| parent | 3cba603eae1a1c8b0338f5584041c73d55682c0a (diff) | |
| download | zig-76176104001420ea04840f9b31e706289e4ebf11.tar.gz zig-76176104001420ea04840f9b31e706289e4ebf11.zip | |
Merge pull request #4550 from ziglang/os-version-ranges
introduce operating system version ranges as part of the target; self-host native dynamic linker detection and native glibc version detection
Diffstat (limited to 'lib/std/child_process.zig')
| -rw-r--r-- | lib/std/child_process.zig | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index bb8ed2e8a0..d5e914b286 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -17,9 +17,9 @@ const TailQueue = std.TailQueue; const maxInt = std.math.maxInt; pub const ChildProcess = struct { - pid: if (builtin.os == .windows) void else i32, - handle: if (builtin.os == .windows) windows.HANDLE else void, - thread_handle: if (builtin.os == .windows) windows.HANDLE else void, + pid: if (builtin.os.tag == .windows) void else i32, + handle: if (builtin.os.tag == .windows) windows.HANDLE else void, + thread_handle: if (builtin.os.tag == .windows) windows.HANDLE else void, allocator: *mem.Allocator, @@ -39,15 +39,15 @@ pub const ChildProcess = struct { stderr_behavior: StdIo, /// Set to change the user id when spawning the child process. - uid: if (builtin.os == .windows) void else ?u32, + uid: if (builtin.os.tag == .windows) void else ?u32, /// Set to change the group id when spawning the child process. - gid: if (builtin.os == .windows) void else ?u32, + gid: if (builtin.os.tag == .windows) void else ?u32, /// Set to change the current working directory when spawning the child process. cwd: ?[]const u8, - err_pipe: if (builtin.os == .windows) void else [2]os.fd_t, + err_pipe: if (builtin.os.tag == .windows) void else [2]os.fd_t, expand_arg0: Arg0Expand, @@ -96,8 +96,8 @@ pub const ChildProcess = struct { .term = null, .env_map = null, .cwd = null, - .uid = if (builtin.os == .windows) {} else null, - .gid = if (builtin.os == .windows) {} else null, + .uid = if (builtin.os.tag == .windows) {} else null, + .gid = if (builtin.os.tag == .windows) {} else null, .stdin = null, .stdout = null, .stderr = null, @@ -118,7 +118,7 @@ pub const ChildProcess = struct { /// On success must call `kill` or `wait`. pub fn spawn(self: *ChildProcess) SpawnError!void { - if (builtin.os == .windows) { + if (builtin.os.tag == .windows) { return self.spawnWindows(); } else { return self.spawnPosix(); @@ -132,7 +132,7 @@ pub const ChildProcess = struct { /// Forcibly terminates child process and then cleans up all resources. pub fn kill(self: *ChildProcess) !Term { - if (builtin.os == .windows) { + if (builtin.os.tag == .windows) { return self.killWindows(1); } else { return self.killPosix(); @@ -162,7 +162,7 @@ pub const ChildProcess = struct { /// Blocks until child process terminates and then cleans up all resources. pub fn wait(self: *ChildProcess) !Term { - if (builtin.os == .windows) { + if (builtin.os.tag == .windows) { return self.waitWindows(); } else { return self.waitPosix(); @@ -307,7 +307,7 @@ pub const ChildProcess = struct { fn cleanupAfterWait(self: *ChildProcess, status: u32) !Term { defer destroyPipe(self.err_pipe); - if (builtin.os == .linux) { + if (builtin.os.tag == .linux) { var fd = [1]std.os.pollfd{std.os.pollfd{ .fd = self.err_pipe[0], .events = std.os.POLLIN, @@ -402,7 +402,7 @@ pub const ChildProcess = struct { // This pipe is used to communicate errors between the time of fork // and execve from the child process to the parent process. const err_pipe = blk: { - if (builtin.os == .linux) { + if (builtin.os.tag == .linux) { const fd = try os.eventfd(0, 0); // There's no distinction between the readable and the writeable // end with eventfd |
