| ... | @@ -37,6 +37,9 @@ stdin_behavior: std.ChildProcess.StdIo = .Inherit, | ... | @@ -37,6 +37,9 @@ stdin_behavior: std.ChildProcess.StdIo = .Inherit, |
| 37 | | 37 | |
| 38 | expected_exit_code: u8 = 0, | 38 | expected_exit_code: u8 = 0, |
| 39 | | 39 | |
| | 40 | /// Print the command before running it |
| | 41 | print: bool, |
| | 42 | |
| 40 | pub const StdIoAction = union(enum) { | 43 | pub const StdIoAction = union(enum) { |
| 41 | inherit, | 44 | inherit, |
| 42 | ignore, | 45 | ignore, |
| ... | @@ -58,6 +61,7 @@ pub fn create(builder: *Builder, name: []const u8) *RunStep { | ... | @@ -58,6 +61,7 @@ pub fn create(builder: *Builder, name: []const u8) *RunStep { |
| 58 | .argv = ArrayList(Arg).init(builder.allocator), | 61 | .argv = ArrayList(Arg).init(builder.allocator), |
| 59 | .cwd = null, | 62 | .cwd = null, |
| 60 | .env_map = null, | 63 | .env_map = null, |
| | 64 | .print = builder.verbose, |
| 61 | }; | 65 | }; |
| 62 | return self; | 66 | return self; |
| 63 | } | 67 | } |
| ... | @@ -181,6 +185,9 @@ fn make(step: *Step) !void { | ... | @@ -181,6 +185,9 @@ fn make(step: *Step) !void { |
| 181 | child.stdout_behavior = stdIoActionToBehavior(self.stdout_action); | 185 | child.stdout_behavior = stdIoActionToBehavior(self.stdout_action); |
| 182 | child.stderr_behavior = stdIoActionToBehavior(self.stderr_action); | 186 | child.stderr_behavior = stdIoActionToBehavior(self.stderr_action); |
| 183 | | 187 | |
| | 188 | if (self.print) |
| | 189 | printCmd(cwd, argv); |
| | 190 | |
| 184 | child.spawn() catch |err| { | 191 | child.spawn() catch |err| { |
| 185 | warn("Unable to spawn {s}: {s}\n", .{ argv[0], @errorName(err) }); | 192 | warn("Unable to spawn {s}: {s}\n", .{ argv[0], @errorName(err) }); |
| 186 | return err; | 193 | return err; |