From d9a60036d9d2db9a339a2079fa5e3b49057e720c Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Sun, 26 Mar 2023 23:46:32 +0100 Subject: [PATCH] Linux - always overwrite update log Also i need a new build to test :) --- src/Artemis.UI.Linux/ApplicationStateManager.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Artemis.UI.Linux/ApplicationStateManager.cs b/src/Artemis.UI.Linux/ApplicationStateManager.cs index dd4ae179a..41b999a65 100644 --- a/src/Artemis.UI.Linux/ApplicationStateManager.cs +++ b/src/Artemis.UI.Linux/ApplicationStateManager.cs @@ -154,18 +154,16 @@ public class ApplicationStateManager RunScriptWithOutputFile(script, $"{source} {destination} {args}", Path.Combine(Constants.DataFolder, "update-log.txt")); - // Lets try a graceful shutdown, PowerShell will kill if needed + // Lets try a graceful shutdown, the script will kill if needed if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime) Dispatcher.UIThread.Post(() => controlledApplicationLifetime.Shutdown()); } - private void RunScriptWithOutputFile(string script, string arguments, string outputFile) + private static void RunScriptWithOutputFile(string script, string arguments, string outputFile) { - // Use > for files that are bigger than 200kb to start fresh, otherwise use >> to append - string redirectSymbol = File.Exists(outputFile) && new FileInfo(outputFile).Length > 200000 ? ">" : ">>"; ProcessStartInfo info = new() { - Arguments = $"\"{script}\" {arguments} {redirectSymbol} \"{outputFile}\"", + Arguments = $"\"{script}\" {arguments} > \"{outputFile}\"", FileName = "/bin/bash", WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true,