win32: print to the terminal if disabling sleep fails

pull/2087/head
Paper 2023-09-02 15:27:58 -04:00
parent 8f6a6484d2
commit f308192f54
No known key found for this signature in database
4 changed files with 8 additions and 3 deletions

View File

@ -223,7 +223,8 @@ Context::Context(bool standalone, int argc, char** argv, const KeyVals& options)
}
#ifdef _WIN32
if (op->getAsBool(PREF_DISABLE_SLEEP)) {
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
if (!SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED))
A2_LOG_WARN("--disable-sleep-until-finished: Failed to disable sleep mode.");
}
#endif // _WIN32
SocketCore::setIpDscp(op->getAsInt(PREF_DSCP));

View File

@ -334,8 +334,10 @@ PrefPtr PREF_SHOW_CONSOLE_READOUT = makePref("show-console-readout");
PrefPtr PREF_STREAM_PIECE_SELECTOR = makePref("stream-piece-selector");
// value: true | false
PrefPtr PREF_TRUNCATE_CONSOLE_READOUT = makePref("truncate-console-readout");
#ifdef _WIN32
// value: true | false
PrefPtr PREF_DISABLE_SLEEP = makePref("disable-sleep-until-finished")
PrefPtr PREF_DISABLE_SLEEP = makePref("disable-sleep-until-finished");
#endif // _WIN32
// value: true | false
PrefPtr PREF_PAUSE = makePref("pause");
// value: default | full | hide

View File

@ -287,8 +287,10 @@ extern PrefPtr PREF_SHOW_CONSOLE_READOUT;
extern PrefPtr PREF_STREAM_PIECE_SELECTOR;
// value: true | false
extern PrefPtr PREF_TRUNCATE_CONSOLE_READOUT;
#ifdef _WIN32
// value: true | false
extern PrefPtr PREF_DISABLE_SLEEP;
#endif // _WIN32
// value: true | false
extern PrefPtr PREF_PAUSE;
// value: default | full | hide

View File

@ -885,7 +885,7 @@
_(" --truncate-console-readout[=true|false] Truncate console readout to fit in\n"\
" a single line.")
#ifdef _WIN32
#define TEXT_DISABLE_SLEEP
#define TEXT_DISABLE_SLEEP \
_(" --disable-sleep-until-finished[=true|false] Disables sleep mode on Windows\n" \
" until downloads are finished.")
#endif // _WIN32