Fix issue where quitting app no longer works after exiting a process in stream

This commit is contained in:
loki 2019-12-30 23:23:28 +01:00
parent 1e2faea1ac
commit daaec4ba46
2 changed files with 9 additions and 0 deletions

View File

@ -42,6 +42,13 @@ int exe(const std::string &cmd, bp::environment &env, file_t &file, std::error_c
}
int proc_t::execute(int app_id) {
if(!_process.running() && _app_id != -1) {
// previous process exited on it's own, reset _process_handle
_process_handle = bp::group();
_app_id = -1;
}
if(app_id >= _apps.size()) {
std::cout << "Error: Couldn't find app with ID ["sv << app_id << ']' << std::endl;
@ -115,6 +122,7 @@ void proc_t::terminate() {
// Ensure child process is terminated
process_end(_process, _process_handle);
_app_id = -1;
if(ec) {
std::cout << "FATAL Error: System: "sv << ec.message() << std::endl;

View File

@ -49,6 +49,7 @@ public:
proc_t(
boost::process::environment &&env,
std::vector<ctx_t> &&apps) :
_app_id(-1),
_env(std::move(env)),
_apps(std::move(apps)) {}