authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2020-03-16 22:10:07+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-16 17:23:53-04:00
log6a15d668ee1fd3cfc72b409e56a72b93ca46e1be
treefcb831b0564293e6f033a527169c88d2f35860d8
parent582991a5a818179881f7923c7e6cff10de50dfcf

Change the default stdin behavior of RunStep to .Inherit

This behaves the same as stdout and stderr behavior which also default to .inherit. Also adds a field to RunStep to change the behavior. Since this is a breaking change, previous behavior can be restored by doing: `RunStep.stdin_behavior = .Ignore`.

1 files changed, 3 insertions(+), 1 deletions(-)

lib/std/build/run.zig+3-1
...@@ -29,6 +29,8 @@ pub const RunStep = struct {...@@ -29,6 +29,8 @@ pub const RunStep = struct {
29 stdout_action: StdIoAction = .inherit,29 stdout_action: StdIoAction = .inherit,
30 stderr_action: StdIoAction = .inherit,30 stderr_action: StdIoAction = .inherit,
3131
32 stdin_behavior: std.ChildProcess.StdIo = .Inherit,
33
32 expected_exit_code: u8 = 0,34 expected_exit_code: u8 = 0,
3335
34 pub const StdIoAction = union(enum) {36 pub const StdIoAction = union(enum) {
...@@ -159,7 +161,7 @@ pub const RunStep = struct {...@@ -159,7 +161,7 @@ pub const RunStep = struct {
159 child.cwd = cwd;161 child.cwd = cwd;
160 child.env_map = self.env_map orelse self.builder.env_map;162 child.env_map = self.env_map orelse self.builder.env_map;
161163
162 child.stdin_behavior = .Ignore;164 child.stdin_behavior = self.stdin_behavior;
163 child.stdout_behavior = stdIoActionToBehavior(self.stdout_action);165 child.stdout_behavior = stdIoActionToBehavior(self.stdout_action);
164 child.stderr_behavior = stdIoActionToBehavior(self.stderr_action);166 child.stderr_behavior = stdIoActionToBehavior(self.stderr_action);
165167