@@ -753,29 +753,30 @@ namespace proc {
753753 void refresh (const std::string &file_name) {
754754 auto proc_opt = proc::parse (file_name);
755755
756- if (proc_opt) {
757- // If it is running, the environment variable (SUNSHINE_*) should be kept.
758- // These variables are dynamically added in execute() and should not be
759- // overridden by environment variables in the configuration file
760- if (proc.running ()) {
761- const boost::process::v1::environment ¤t_env = proc.get_env ();
762- boost::process::v1::environment new_env = proc_opt->get_env ();
763-
764- // Copy the 'SUNSHINE_*' from the current environment into the new environment.
765- for (const auto &entry : current_env) {
766- const std::string &var_name = entry.get_name ();
767- if (var_name.find (" SUNSHINE_" ) == 0 ) {
768- new_env[var_name] = entry.to_string ();
769- }
756+ if (!proc_opt) {
757+ return ;
758+ }
759+ // If it is running, the environment variable (SUNSHINE_*) should be kept.
760+ // These variables are dynamically added in execute() and should not be
761+ // overridden by environment variables in the configuration file
762+ if (proc.running ()) {
763+ const boost::process::v1::environment ¤t_env = proc.get_env ();
764+ boost::process::v1::environment new_env = proc_opt->get_env ();
765+
766+ // Copy the 'SUNSHINE_*' from the current environment into the new environment.
767+ for (const auto &entry : current_env) {
768+ const std::string &var_name = entry.get_name ();
769+ if (var_name.find (" SUNSHINE_" ) == 0 ) {
770+ new_env[var_name] = entry.to_string ();
770771 }
771-
772- proc.set_env (std::move (new_env));
773- }
774- else {
775- // Not a running state, which can safely replace environment variables
776- proc.set_env (proc_opt->get_env ());
777772 }
778- proc.set_apps (proc_opt->get_apps ());
773+
774+ proc.set_env (std::move (new_env));
775+ }
776+ else {
777+ // Not a running state, which can safely replace environment variables
778+ proc.set_env (proc_opt->get_env ());
779779 }
780+ proc.set_apps (proc_opt->get_apps ());
780781 }
781782} // namespace proc
0 commit comments