forked from lix-project/lix
libutil: make RunningProgram::wait more resilient
this will usually be used either directly (which is always fine) or in
Finally blocks (where it must never throw execptions). make sure that,
exceptions being handled or not, the calling wait() in Finally doesn't
cause crashes due to the Finally no-nested-exceptions-thrown assertion
Change-Id: Ib83a5d9483b1fe83b9a957dcefeefce5d088f06d
This commit is contained in:
parent
c907d805bf
commit
868eb5ecde
|
@ -280,9 +280,14 @@ RunningProgram::~RunningProgram()
|
||||||
|
|
||||||
void RunningProgram::wait()
|
void RunningProgram::wait()
|
||||||
{
|
{
|
||||||
int status = pid.wait();
|
if (std::uncaught_exceptions() == 0) {
|
||||||
if (status)
|
int status = pid.wait();
|
||||||
throw ExecError(status, "program '%1%' %2%", program, statusToString(status));
|
if (status)
|
||||||
|
throw ExecError(status, "program '%1%' %2%", program, statusToString(status));
|
||||||
|
} else {
|
||||||
|
pid.kill();
|
||||||
|
debug("killed subprocess %1% during exception handling", program);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RunningProgram runProgram2(const RunOptions & options)
|
RunningProgram runProgram2(const RunOptions & options)
|
||||||
|
|
Loading…
Reference in a new issue