| ... | @@ -155,14 +155,18 @@ pub fn file_list(dpath: []const u8, list: *std.ArrayList([]const u8)) !void { | ... | @@ -155,14 +155,18 @@ pub fn file_list(dpath: []const u8, list: *std.ArrayList([]const u8)) !void { |
| 155 | } | 155 | } |
| 156 | } | 156 | } |
| 157 | | 157 | |
| 158 | pub fn run_cmd(dir: ?[]const u8, args: []const []const u8) !u32 { | 158 | pub fn run_cmd_raw(dir: ?[]const u8, args: []const []const u8) !std.ChildProcess.ExecResult { |
| 159 | const result = std.ChildProcess.exec(.{ .allocator = gpa, .cwd = dir, .argv = args, .max_output_bytes = std.math.maxInt(usize) }) catch |e| switch (e) { | 159 | return std.ChildProcess.exec(.{ .allocator = gpa, .cwd = dir, .argv = args, .max_output_bytes = std.math.maxInt(usize) }) catch |e| switch (e) { |
| 160 | error.FileNotFound => { | 160 | error.FileNotFound => { |
| 161 | u.assert(false, "\"{s}\" command not found", .{args[0]}); | 161 | u.assert(false, "\"{s}\" command not found", .{args[0]}); |
| 162 | unreachable; | 162 | unreachable; |
| 163 | }, | 163 | }, |
| 164 | else => return e, | 164 | else => return e, |
| 165 | }; | 165 | }; |
| | 166 | } |
| | 167 | |
| | 168 | pub fn run_cmd(dir: ?[]const u8, args: []const []const u8) !u32 { |
| | 169 | const result = try run_cmd_raw(dir, args); |
| 166 | gpa.free(result.stdout); | 170 | gpa.free(result.stdout); |
| 167 | gpa.free(result.stderr); | 171 | gpa.free(result.stderr); |
| 168 | return result.term.Exited; | 172 | return result.term.Exited; |