diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2019-01-16 00:44:17 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2019-01-16 00:44:17 +0000 |
commit | c03ea582bff36fe020af1aa329b34f3e6d580f92 (patch) | |
tree | 41b8a3085df4de883f2993773b138f1436e041a4 /zen/shutdown.cpp | |
parent | Merge branch '10.7' into 'master' (diff) | |
parent | 10.8 (diff) | |
download | FreeFileSync-c03ea582bff36fe020af1aa329b34f3e6d580f92.tar.gz FreeFileSync-c03ea582bff36fe020af1aa329b34f3e6d580f92.tar.bz2 FreeFileSync-c03ea582bff36fe020af1aa329b34f3e6d580f92.zip |
Merge branch '10.8' into 'master'10.8
10.8
See merge request opensource-tracking/FreeFileSync!5
Diffstat (limited to 'zen/shutdown.cpp')
-rwxr-xr-x | zen/shutdown.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/zen/shutdown.cpp b/zen/shutdown.cpp index 1794e4a8..a25e9c64 100755 --- a/zen/shutdown.cpp +++ b/zen/shutdown.cpp @@ -18,8 +18,7 @@ void zen::shutdownSystem() //throw FileError //https://linux.die.net/man/2/reboot => needs admin rights! //"systemctl" should work without admin rights: - shellExecute("sleep 1; systemctl poweroff", ExecutionType::ASYNC); //throw FileError - //sleep 1: give FFS some time to properly shut down! + shellExecute("systemctl poweroff", ExecutionType::SYNC); //throw FileError } @@ -27,10 +26,20 @@ void zen::shutdownSystem() //throw FileError void zen::suspendSystem() //throw FileError { //"systemctl" should work without admin rights: - shellExecute("systemctl suspend", ExecutionType::ASYNC); //throw FileError + shellExecute("systemctl suspend", ExecutionType::SYNC); //throw FileError } + +void zen::terminateProcess(int exitCode) +{ + std::exit(exitCode); //[[noreturn]]; "Stack is not unwound: destructors of variables with automatic storage duration are not called." => perfect + //don't use std::abort() => crashes process with "EXC_CRASH (SIGABRT)" on macOS + for (;;) //why still here?? => crash deliberately! + *reinterpret_cast<volatile int*>(0) = 0; //crude but at least we'll get crash dumps if it happens +} + + /* Command line alternatives: |