| ... | @@ -397,6 +397,10 @@ pub const Builder = struct { | ... | @@ -397,6 +397,10 @@ pub const Builder = struct { |
| 397 | } | 397 | } |
| 398 | | 398 | |
| 399 | fn spawnChild(self: &Builder, exe_path: []const u8, args: []const []const u8) { | 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 | if (self.verbose) { | 404 | if (self.verbose) { |
| 401 | %%io.stderr.printf("{}", exe_path); | 405 | %%io.stderr.printf("{}", exe_path); |
| 402 | for (args) |arg| { | 406 | for (args) |arg| { |
| ... | @@ -405,7 +409,7 @@ pub const Builder = struct { | ... | @@ -405,7 +409,7 @@ pub const Builder = struct { |
| 405 | %%io.stderr.printf("\n"); | 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 | StdIo.Ignore, StdIo.Inherit, StdIo.Inherit, self.allocator) | 413 | StdIo.Ignore, StdIo.Inherit, StdIo.Inherit, self.allocator) |
| 410 | %% |err| debug.panic("Unable to spawn {}: {}\n", exe_path, @errorName(err)); | 414 | %% |err| debug.panic("Unable to spawn {}: {}\n", exe_path, @errorName(err)); |
| 411 | | 415 | |
| ... | @@ -905,17 +909,19 @@ const CExecutable = struct { | ... | @@ -905,17 +909,19 @@ const CExecutable = struct { |
| 905 | | 909 | |
| 906 | const CommandStep = struct { | 910 | const CommandStep = struct { |
| 907 | step: Step, | 911 | step: Step, |
| 908 | path: []const u8, | 912 | builder: &Builder, |
| | 913 | exe_path: []const u8, |
| 909 | args: []const []const u8, | 914 | args: []const []const u8, |
| 910 | cwd: []const u8, | 915 | cwd: []const u8, |
| 911 | env_map: &const BufMap, | 916 | env_map: &const BufMap, |
| 912 | | 917 | |
| 913 | pub fn init(builder: &Builder, cwd: []const u8, env_map: &const BufMap, | 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 | CommandStep { | 921 | CommandStep { |
| 917 | .step = Step.init(path, builder.allocator, make), | 922 | .builder = builder, |
| 918 | .path = path, | 923 | .step = Step.init(exe_path, builder.allocator, make), |
| | 924 | .exe_path = exe_path, |
| 919 | .args = args, | 925 | .args = args, |
| 920 | .cwd = cwd, | 926 | .cwd = cwd, |
| 921 | .env_map = env_map, | 927 | .env_map = env_map, |
| ... | @@ -927,7 +933,8 @@ const CommandStep = struct { | ... | @@ -927,7 +933,8 @@ const CommandStep = struct { |
| 927 | //const self = @fieldParentPtr(CExecutable, "step", step); | 933 | //const self = @fieldParentPtr(CExecutable, "step", step); |
| 928 | const self = @ptrcast(&CommandStep, step); | 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 | |