diff options
author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2021-01-16 21:30:57 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-03-06 00:24:04 +0100 |
commit | c2068bd4232c7e88037ee9f7590cf817fc6ac0c0 (patch) | |
tree | 5a5577453fd0fc72a103b09f8a741b43ff28f32b /src/common | |
parent | 3d29c26c6154ac5e9b397c48623538bd0a1eea9e (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>
(cherry picked from commit 9af6bf15aa2fe836c3ebba306eaaa8971f00fac4)
Diffstat (limited to 'src/common')
-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 8d713540e11..3cdc5c095bc 100644 --- a/src/common/Utilities/StartProcess.cpp +++ b/src/common/Utilities/StartProcess.cpp @@ -84,17 +84,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 }; |