diff options
author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2021-01-16 21:30:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-16 21:30:57 +0100 |
commit | 9af6bf15aa2fe836c3ebba306eaaa8971f00fac4 (patch) | |
tree | 4cad60a76d90acc2b2424fd79cf33e0359c26e6f /src/common/Utilities/StartProcess.cpp | |
parent | 15d69bd885adca7070d3819493519065f02b35ca (diff) |
CI/CircleCI: Expose binaries built on Circle CI as docker images in the Circle CI artifacts (#25832)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src/common/Utilities/StartProcess.cpp')
-rw-r--r-- | src/common/Utilities/StartProcess.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/Utilities/StartProcess.cpp b/src/common/Utilities/StartProcess.cpp index ab81f4db5df..5c8e0f79763 100644 --- a/src/common/Utilities/StartProcess.cpp +++ b/src/common/Utilities/StartProcess.cpp @@ -81,17 +81,24 @@ static int CreateChildProcess(T waiter, std::string const& executable, executable.c_str(), boost::algorithm::join(argsVector, " ").c_str()); } + // prepare file with only read permission (boost process opens with read_write) + std::shared_ptr<FILE> inputFile(!input.empty() ? fopen(input.c_str(), "rb") : nullptr, [](FILE* ptr) + { + if (ptr != nullptr) + fclose(ptr); + }); + // Start the child process child c = [&]() { - if (!input.empty()) + if (inputFile) { // With binding stdin return child{ exe = boost::filesystem::absolute(executable).string(), args = argsVector, env = environment(boost::this_process::environment()), - std_in = input, + std_in = inputFile.get(), std_out = outStream, std_err = errStream }; |