From c2068bd4232c7e88037ee9f7590cf817fc6ac0c0 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Sat, 16 Jan 2021 21:30:57 +0100 Subject: CI/CircleCI: Expose binaries built on Circle CI as docker images in the Circle CI artifacts (#25832) Co-authored-by: Shauren (cherry picked from commit 9af6bf15aa2fe836c3ebba306eaaa8971f00fac4) --- src/common/Utilities/StartProcess.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/common/Utilities/StartProcess.cpp') 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 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 }; -- cgit v1.2.3