mirror of
https://github.com/zebrajr/SamRewritten.git
synced 2025-12-06 12:19:51 +01:00
Merge pull request #142 from DeadStarlin/SIGINTExitWithError
CLI idle exit with success
This commit is contained in:
commit
9bc4d994b3
|
|
@ -15,7 +15,6 @@
|
|||
void handle_sigint_cli(int signum)
|
||||
{
|
||||
std::cout << "Quitting cli idling" << std::endl;
|
||||
g_steam->quit_game();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +22,13 @@ void idle_app(AppId_t appid)
|
|||
{
|
||||
std::cout << "Idling from command line " << appid << std::endl;
|
||||
g_steam->launch_app(appid);
|
||||
signal(SIGINT, handle_sigint_cli);
|
||||
struct sigaction sigIntHandler;
|
||||
|
||||
sigIntHandler.sa_handler = handle_sigint_cli;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
// Wait for ctrl+c, so we can kill both processes, otherwise
|
||||
// GUI process will exit while game process still goes on
|
||||
|
|
@ -296,7 +301,13 @@ bool go_cli_mode(int argc, char* argv[], AppId_t *return_app_id) {
|
|||
if (result.count("timed") > 0) {
|
||||
// Hook this up since we'll probably be in this function for a while
|
||||
// Really we could hook this up whenever we launch the app...
|
||||
signal(SIGINT, handle_sigint_cli);
|
||||
struct sigaction sigIntHandler;
|
||||
|
||||
sigIntHandler.sa_handler = handle_sigint_cli;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
if (app == 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user