From 21c3e4a1a3b83ca99f018a9cc619bd9845a6a0c9 Mon Sep 17 00:00:00 2001 From: Archi Date: Sun, 25 Jul 2021 23:35:56 +0200 Subject: [PATCH] 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. --- ArchiSteamFarm/Steam/Interaction/Actions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ArchiSteamFarm/Steam/Interaction/Actions.cs b/ArchiSteamFarm/Steam/Interaction/Actions.cs index 9aafe0d62..d9bc7eed3 100644 --- a/ArchiSteamFarm/Steam/Interaction/Actions.cs +++ b/ArchiSteamFarm/Steam/Interaction/Actions.cs @@ -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 () => {