Refuse to handle Resart() when in --no-restart mode

While AutoRestart property in the config is a hint for ASF what it should be doing, --no-restart cmd-line argument is used in scripts and environments that must directly monitor the process, e.g. Docker. In such environments, we should refuse a call to Restart() action, as it's never feasible.
This commit is contained in:
Archi
2021-07-25 23:35:56 +02:00
parent 517ced1e14
commit 21c3e4a1a3

View File

@@ -248,6 +248,10 @@ namespace ArchiSteamFarm.Steam.Interaction {
[PublicAPI]
public static (bool Success, string Message) Restart() {
if (!Program.RestartAllowed) {
return (false, "!" + nameof(Program.RestartAllowed));
}
// Schedule the task after some time so user can receive response
Utilities.InBackground(
async () => {