1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Linux - always overwrite update log

Also i need a new build  to test :)
This commit is contained in:
Diogo Trindade 2023-03-26 23:46:32 +01:00
parent 0f61ad8c7b
commit d9a60036d9

View File

@ -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,