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