Skip to content

Commit

Permalink
Changed the -sudokill mode to use killall, fixes pidof failing on c…
Browse files Browse the repository at this point in the history
…ertain processes (fallout-ce, fallout2-ce).
  • Loading branch information
kloptops committed Feb 18, 2023
1 parent c2f5d38 commit 9be6db9
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,24 +355,32 @@ void doKillMode()
SDL_Delay(15);
emitKey(KEY_F4, false, KEY_LEFTALT);
}

SDL_RemoveTimer( state.key_repeat_timer_id );
if (! sudo_kill) {
// printf("Killing: %s\n", AppToKill);
if (state.start_jsdevice == state.hotkey_jsdevice) {
system((" killall '" + std::string(AppToKill) + "' ").c_str());
system("show_splash.sh exit");
if (state.start_jsdevice == state.hotkey_jsdevice) {
if (! sudo_kill) {
// printf("Killing: %s\n", AppToKill);
system((" killall '" + std::string(AppToKill) + "' ").c_str());
system("show_splash.sh exit");

sleep(3);
if (system((" pgrep '" + std::string(AppToKill) + "' ").c_str()) == 0) {
printf("Forcefully Killing: %s\n", AppToKill);
system((" killall -9 '" + std::string(AppToKill) + "' ").c_str());
}

exit(0);
}
} else {
if (state.start_jsdevice == state.hotkey_jsdevice) {
system((" kill -9 $(pidof '" + std::string(AppToKill) + "') ").c_str());
} else {
// printf("Killing: %s\n", AppToKill);
system((" sudo killall '" + std::string(AppToKill) + "' ").c_str());

sleep(3);
exit(0);
if (system((" pgrep '" + std::string(AppToKill) + "' ").c_str()) == 0) {
printf("Forcefully Killing: %s\n", AppToKill);
system((" sudo killall -9 '" + std::string(AppToKill) + "' ").c_str());
}

exit(0);
}
} // sudo kill
}

0 comments on commit 9be6db9

Please sign in to comment.