Skip to content

Commit 0299cd7

Browse files
keithcopybara-github
authored andcommitted
Remove wrapped_clang params files after use
We use TempFile's destructor to remove the params file. Because we previously exec'd a new process, this was never called. Now we run them as subprocesses so we can cleanup afterwards. Closes #12896. PiperOrigin-RevId: 366211823
1 parent 551fabd commit 0299cd7

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

tools/osx/crosstool/wrapped_clang.cc

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ std::vector<const char *> ConvertToCArgs(const std::vector<std::string> &args) {
108108
return c_args;
109109
}
110110

111-
// Turn our current process into a new process. Avoids fork overhead.
112-
// Never returns.
113-
void ExecProcess(const std::vector<std::string> &args) {
114-
std::vector<const char *> exec_argv = ConvertToCArgs(args);
115-
execv(args[0].c_str(), const_cast<char **>(exec_argv.data()));
116-
std::cerr << "Error executing child process.'" << args[0] << "'. "
117-
<< strerror(errno) << "\n";
118-
abort();
119-
}
120-
121111
// Spawns a subprocess for given arguments args. The first argument is used
122112
// for the executable path.
123113
void RunSubProcess(const std::vector<std::string> &args) {
@@ -410,19 +400,13 @@ int main(int argc, char *argv[]) {
410400
}
411401
}
412402

403+
RunSubProcess(invocation_args);
413404
if (!postprocess) {
414-
ExecProcess(invocation_args);
415-
std::cerr << "ExecProcess should not return. Please fix!\n";
416-
abort();
405+
return 0;
417406
}
418407

419-
RunSubProcess(invocation_args);
420-
421408
std::vector<std::string> dsymutil_args = {
422409
"/usr/bin/xcrun", "dsymutil", linked_binary, "-o", dsym_path, "--flat"};
423-
ExecProcess(dsymutil_args);
424-
std::cerr << "ExecProcess should not return. Please fix!\n";
425-
abort();
426-
410+
RunSubProcess(dsymutil_args);
427411
return 0;
428412
}

0 commit comments

Comments
 (0)