Skip to content

Commit

Permalink
do not wait for hanging processes in system module
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed May 15, 2024
1 parent f227d61 commit 5e8fb42
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libtascar/src/spawn_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ void TASCAR::spawn_process_t::launcher()
mtx.unlock();
#ifndef _WIN32
int wstatus = 0;
waitpid(pid, &wstatus, 0);
bool stillrunning = true;
while(runservice && stillrunning) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
int opid = waitpid(pid, &wstatus, WNOHANG);
if(opid != 0)
stillrunning = false;
}
if(runservice) {
if(WIFEXITED(wstatus) && (WEXITSTATUS(wstatus) != 0))
std::cerr << "Process " << pid << " returned with exit status "
Expand Down

0 comments on commit 5e8fb42

Please sign in to comment.