Skip to content

Commit

Permalink
fix(process): proc status lost when streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroKaku committed Nov 25, 2024
1 parent d5854ae commit 327ce77
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ namespace proc {
proc_t::get_apps() {
return _apps;
}
void
proc_t::set_apps(std::vector<ctx_t> apps) {
_apps = std::move(apps);
}

// Gets application image from application list.
// Returns image from assets directory if found there.
Expand All @@ -382,6 +386,19 @@ namespace proc {
return _app.name;
}

const boost::process::v1::environment &
proc_t::get_env() const {
return _env;
}
boost::process::v1::environment &
proc_t::get_env() {
return _env;
}
void
proc_t::set_env(boost::process::v1::environment env) {
_env = std::move(env);
}

proc_t::~proc_t() {
// It's not safe to call terminate() here because our proc_t is a static variable
// that may be destroyed after the Boost loggers have been destroyed. Instead,
Expand Down Expand Up @@ -716,7 +733,8 @@ namespace proc {
auto proc_opt = proc::parse(file_name);

if (proc_opt) {
proc = std::move(*proc_opt);
proc.set_env(proc_opt->get_env());
proc.set_apps(proc_opt->get_apps());
}
}
} // namespace proc
8 changes: 8 additions & 0 deletions src/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,18 @@ namespace proc {
get_apps() const;
std::vector<ctx_t> &
get_apps();
void
set_apps(std::vector<ctx_t> apps);
std::string
get_app_image(int app_id);
std::string
get_last_run_app_name();
const boost::process::v1::environment &
get_env() const;
boost::process::v1::environment &
get_env();
void
set_env(boost::process::v1::environment env);
void
terminate();

Expand Down

0 comments on commit 327ce77

Please sign in to comment.