Skip to content
Snippets Groups Projects
Commit 05a912eb authored by Carl Philipp Klemm's avatar Carl Philipp Klemm
Browse files

Biocontrol: dont leak filedescriptor

parent 8f11bbd8
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,8 @@ void BioControl::execBiocontrol(const std::string& command, const std::string& u
while((ret = waitpid(childPid, &exitCode, WNOHANG)) == 0 && --timeout > 0)
std::this_thread::sleep_for(std::chrono::milliseconds(500));
close(biopipe);
if(ret == 0)
{
kill(childPid, SIGKILL);
......@@ -85,12 +87,9 @@ void BioControl::execBiocontrol(const std::string& command, const std::string& u
}
if(exitCode != 0)
{
close(biopipe);
throw std::runtime_error(std::string(__func__) + ": biocontol failed with: " + std::to_string(exitCode));
}
}
}
bool BioControl::measure_eis(const std::filesystem::path& outPath, const std::string& userstr, bool retry)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment