| ... | @@ -332,6 +332,12 @@ pub fn make( | ... | @@ -332,6 +332,12 @@ pub fn make( |
| 332 | | 332 | |
| 333 | try populateGeneratedStdIo(maker, &conf_run, cache_root, &digest); | 333 | try populateGeneratedStdIo(maker, &conf_run, cache_root, &digest); |
| 334 | try populateGeneratedPaths(maker, output_placeholders.items, cache_root, &digest); | 334 | try populateGeneratedPaths(maker, output_placeholders.items, cache_root, &digest); |
| | 335 | |
| | 336 | // The utility functions that spawn the child process must unconditionally allocate |
| | 337 | // the failed command because at that point it is not known whether the step will |
| | 338 | // pass or fail based on the process termination. Here we free the memory since |
| | 339 | // the step has succeeded. |
| | 340 | step.clearFailedCommand(gpa); |
| 335 | } | 341 | } |
| 336 | | 342 | |
| 337 | /// Reads stdout of a Zig test process until a termination condition is reached: | 343 | /// Reads stdout of a Zig test process until a termination condition is reached: |
| ... | @@ -2148,7 +2154,11 @@ fn spawnChildAndCollect( | ... | @@ -2148,7 +2154,11 @@ fn spawnChildAndCollect( |
| 2148 | .dir => unreachable, | 2154 | .dir => unreachable, |
| 2149 | .inherit => null, | 2155 | .inherit => null, |
| 2150 | }; | 2156 | }; |
| 2151 | errdefer step.setFailedCommand(gpa, argv, .{ | 2157 | // We have to set the failed command here regardless of whether this |
| | 2158 | // function returns an error because only after this function returns |
| | 2159 | // does the logic determine whether the child process termination was |
| | 2160 | // success or failure. |
| | 2161 | step.setFailedCommand(gpa, argv, .{ |
| 2152 | .cwd = cwd_string, | 2162 | .cwd = cwd_string, |
| 2153 | .child_env = environ_map, | 2163 | .child_env = environ_map, |
| 2154 | .parent_env = &graph.environ_map, | 2164 | .parent_env = &graph.environ_map, |