Fix Command Failure on cold starts with Desktop (#1652)
This commit is contained in:
@@ -180,19 +180,18 @@ namespace proc {
|
|||||||
auto child = platf::run_command(cmd.elevated, true, cmd.do_cmd, working_dir, _env, _pipe.get(), ec, nullptr);
|
auto child = platf::run_command(cmd.elevated, true, cmd.do_cmd, working_dir, _env, _pipe.get(), ec, nullptr);
|
||||||
|
|
||||||
if (ec) {
|
if (ec) {
|
||||||
auto msg = ec == std::errc::no_such_process ? "no active user sessions available" : ec.message();
|
BOOST_LOG(error) << "Couldn't run ["sv << cmd.do_cmd << "]: System: "sv << ec.message();
|
||||||
BOOST_LOG(error) << "Couldn't run ["sv << cmd.do_cmd << "]: System: "sv << msg;
|
|
||||||
// We don't want any prep commands failing launch of the desktop.
|
// We don't want any prep commands failing launch of the desktop.
|
||||||
// This is to prevent the issue where users reboot their PC and need to log in with Sunshine.
|
// This is to prevent the issue where users reboot their PC and need to log in with Sunshine.
|
||||||
// no_such_process is returned when the impersonation fails, which is typically when there is no user session active.
|
// permission_denied is typically returned when the user impersonation fails, which can happen when user is not signed in yet.
|
||||||
if (!(_app.cmd.empty() && ec == std::errc::no_such_process)) {
|
if (!(_app.cmd.empty() && ec == std::errc::permission_denied)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
child.wait();
|
child.wait();
|
||||||
auto ret = child.exit_code();
|
auto ret = child.exit_code();
|
||||||
if (ret != 0 && ec != std::errc::no_such_process) {
|
if (ret != 0 && ec != std::errc::permission_denied) {
|
||||||
BOOST_LOG(error) << '[' << cmd.do_cmd << "] failed with code ["sv << ret << ']';
|
BOOST_LOG(error) << '[' << cmd.do_cmd << "] failed with code ["sv << ret << ']';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user