| ... | ... | @@ -397,6 +397,10 @@ pub const Builder = struct { |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | fn spawnChild(self: &Builder, exe_path: []const u8, args: []const []const u8) { |
| 400 | return self.spawnChildEnvMap(&self.env_map, exe_path, args); |
| 401 | } |
| 402 | |
| 403 | fn spawnChildEnvMap(self: &Builder, env_map: &const BufMap, exe_path: []const u8, args: []const []const u8) { |
| 400 | 404 | if (self.verbose) { |
| 401 | 405 | %%io.stderr.printf("{}", exe_path); |
| 402 | 406 | for (args) |arg| { |
| ... | ... | @@ -405,7 +409,7 @@ pub const Builder = struct { |
| 405 | 409 | %%io.stderr.printf("\n"); |
| 406 | 410 | } |
| 407 | 411 | |
| 408 | | var child = os.ChildProcess.spawn(exe_path, args, &self.env_map, |
| 412 | var child = os.ChildProcess.spawn(exe_path, args, env_map, |
| 409 | 413 | StdIo.Ignore, StdIo.Inherit, StdIo.Inherit, self.allocator) |
| 410 | 414 | %% |err| debug.panic("Unable to spawn {}: {}\n", exe_path, @errorName(err)); |
| 411 | 415 | |
| ... | ... | @@ -905,17 +909,19 @@ const CExecutable = struct { |
| 905 | 909 | |
| 906 | 910 | const CommandStep = struct { |
| 907 | 911 | step: Step, |
| 908 | | path: []const u8, |
| 912 | builder: &Builder, |
| 913 | exe_path: []const u8, |
| 909 | 914 | args: []const []const u8, |
| 910 | 915 | cwd: []const u8, |
| 911 | 916 | env_map: &const BufMap, |
| 912 | 917 | |
| 913 | 918 | pub fn init(builder: &Builder, cwd: []const u8, env_map: &const BufMap, |
| 914 | | path: []const u8, args: []const []const u8) -> CommandStep |
| 919 | exe_path: []const u8, args: []const []const u8) -> CommandStep |
| 915 | 920 | { |
| 916 | 921 | CommandStep { |
| 917 | | .step = Step.init(path, builder.allocator, make), |
| 918 | | .path = path, |
| 922 | .builder = builder, |
| 923 | .step = Step.init(exe_path, builder.allocator, make), |
| 924 | .exe_path = exe_path, |
| 919 | 925 | .args = args, |
| 920 | 926 | .cwd = cwd, |
| 921 | 927 | .env_map = env_map, |
| ... | ... | @@ -927,7 +933,8 @@ const CommandStep = struct { |
| 927 | 933 | //const self = @fieldParentPtr(CExecutable, "step", step); |
| 928 | 934 | const self = @ptrcast(&CommandStep, step); |
| 929 | 935 | |
| 930 | | %%io.stderr.printf("TODO: exec command\n"); |
| 936 | // TODO set cwd |
| 937 | self.builder.spawnChildEnvMap(self.env_map, self.exe_path, self.args); |
| 931 | 938 | } |
| 932 | 939 | }; |
| 933 | 940 | |