mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-04 20:36:20 -04:00
Forked subprocess not exited if execve failed (#54)
* Fixed: forked subprocess not exited if execve failed In lengthy processes (daemons, etc) this bug keeps open this subprocess. The subprocess continues to work (parallel to parent process) from after failed command start * Fixed: deadlock on using multithreaded application For example if application uses spdlog logger library and set spdlog::flush_every(std::chrono::seconds(1)); then it starts it's own thread which flushes logs every 1 second. In this case if execve failed to execute given command, then parent and subprocess deadlocked.
This commit is contained in:
parent
a458bcfc4a
commit
f1a698b50e
@ -1668,12 +1668,11 @@ namespace detail {
|
||||
std::string err_msg(exp.what());
|
||||
//ATTN: Can we do something on error here ?
|
||||
util::write_n(err_wr_pipe_, err_msg.c_str(), err_msg.length());
|
||||
throw;
|
||||
}
|
||||
|
||||
// Calling application would not get this
|
||||
// exit failure
|
||||
exit (EXIT_FAILURE);
|
||||
_exit (EXIT_FAILURE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user