| ... | ... | @@ -105,37 +105,21 @@ pub const ChildProcess = struct { |
| 105 | 105 | maybe_cwd: ?[]const u8, env_map: &const BufMap, |
| 106 | 106 | stdin: StdIo, stdout: StdIo, stderr: StdIo, allocator: &Allocator) -> %ChildProcess |
| 107 | 107 | { |
| 108 | | // TODO issue #295 |
| 109 | | //const stdin_pipe = if (stdin == StdIo.Pipe) %return makePipe() else undefined; |
| 110 | | var stdin_pipe: [2]i32 = undefined; |
| 111 | | if (stdin == StdIo.Pipe) |
| 112 | | stdin_pipe = %return makePipe(); |
| 108 | const stdin_pipe = if (stdin == StdIo.Pipe) %return makePipe() else undefined; |
| 113 | 109 | %defer if (stdin == StdIo.Pipe) { destroyPipe(stdin_pipe); }; |
| 114 | 110 | |
| 115 | | // TODO issue #295 |
| 116 | | //const stdout_pipe = if (stdout == StdIo.Pipe) %return makePipe() else undefined; |
| 117 | | var stdout_pipe: [2]i32 = undefined; |
| 118 | | if (stdout == StdIo.Pipe) |
| 119 | | stdout_pipe = %return makePipe(); |
| 111 | const stdout_pipe = if (stdout == StdIo.Pipe) %return makePipe() else undefined; |
| 120 | 112 | %defer if (stdout == StdIo.Pipe) { destroyPipe(stdout_pipe); }; |
| 121 | 113 | |
| 122 | | // TODO issue #295 |
| 123 | | //const stderr_pipe = if (stderr == StdIo.Pipe) %return makePipe() else undefined; |
| 124 | | var stderr_pipe: [2]i32 = undefined; |
| 125 | | if (stderr == StdIo.Pipe) |
| 126 | | stderr_pipe = %return makePipe(); |
| 114 | const stderr_pipe = if (stderr == StdIo.Pipe) %return makePipe() else undefined; |
| 127 | 115 | %defer if (stderr == StdIo.Pipe) { destroyPipe(stderr_pipe); }; |
| 128 | 116 | |
| 129 | 117 | const any_ignore = (stdin == StdIo.Ignore or stdout == StdIo.Ignore or stderr == StdIo.Ignore); |
| 130 | | // TODO issue #295 |
| 131 | | //const dev_null_fd = if (any_ignore) { |
| 132 | | // %return os.posixOpen("/dev/null", posix.O_RDWR, 0, null) |
| 133 | | //} else { |
| 134 | | // undefined |
| 135 | | //}; |
| 136 | | var dev_null_fd: i32 = undefined; |
| 137 | | if (any_ignore) |
| 138 | | dev_null_fd = %return os.posixOpen("/dev/null", posix.O_RDWR, 0, null); |
| 118 | const dev_null_fd = if (any_ignore) { |
| 119 | %return os.posixOpen("/dev/null", posix.O_RDWR, 0, null) |
| 120 | } else { |
| 121 | undefined |
| 122 | }; |
| 139 | 123 | |
| 140 | 124 | // This pipe is used to communicate errors between the time of fork |
| 141 | 125 | // and execve from the child process to the parent process. |