fix shutdown.cpp per a macos (altra volta)
This commit is contained in:
@@ -91,33 +91,22 @@ namespace SystemShutdown {
|
||||
}
|
||||
|
||||
#elif __APPLE__
|
||||
// macOS
|
||||
double delay_minutes = config.delay_seconds / 60.0;
|
||||
std::string delay_str = "+" + std::to_string(delay_minutes);
|
||||
if (config.delay_seconds < 60) {
|
||||
delay_str = "+0.1"; // mínimo delay en macOS
|
||||
}
|
||||
|
||||
// macOS - apagado inmediato
|
||||
char* args[] = {
|
||||
const_cast<char*>("shutdown"),
|
||||
const_cast<char*>("-h"),
|
||||
const_cast<char*>(delay_str.c_str()),
|
||||
const_cast<char*>("now"),
|
||||
NULL
|
||||
};
|
||||
|
||||
return executeUnixShutdown("shutdown", args);
|
||||
|
||||
#elif __linux__
|
||||
// Linux
|
||||
std::string delay_str = "+" + std::to_string((config.delay_seconds + 59) / 60); // redondear hacia arriba a minutos
|
||||
if (config.delay_seconds == 0) {
|
||||
delay_str = "now";
|
||||
}
|
||||
|
||||
// Linux - apagado inmediato
|
||||
char* args[] = {
|
||||
const_cast<char*>("shutdown"),
|
||||
const_cast<char*>("-h"),
|
||||
const_cast<char*>(delay_str.c_str()),
|
||||
const_cast<char*>("now"),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user