Fix Process::ResumeSynchronous which waits a process even in case of error

llvm-svn: 236231
This commit is contained in:
Ilia K 2015-04-30 13:10:32 +00:00
parent e740409d52
commit d8c1475f46
1 changed files with 7 additions and 5 deletions

View File

@ -1731,15 +1731,17 @@ Process::ResumeSynchronous (Stream *stream)
HijackProcessEvents(listener_sp.get());
Error error = PrivateResume();
StateType state = WaitForProcessToStop (NULL, NULL, true, listener_sp.get(), stream);
if (error.Success())
{
StateType state = WaitForProcessToStop (NULL, NULL, true, listener_sp.get(), stream);
const bool must_be_alive = false; // eStateExited is ok, so this must be false
if (!StateIsStoppedState(state, must_be_alive))
error.SetErrorStringWithFormat("process not in stopped state after synchronous resume: %s", StateAsCString(state));
}
// Undo the hijacking of process events...
RestoreProcessEvents();
if (error.Success() && !StateIsStoppedState(state, false))
error.SetErrorStringWithFormat("process not in stopped state after synchronous resume: %s", StateAsCString(state));
return error;
}