Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(process): proc status lost when streaming #3417

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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