mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Linux - always overwrite update log
Also i need a new build to test :)
This commit is contained in:
parent
0f61ad8c7b
commit
d9a60036d9
@ -154,18 +154,16 @@ public class ApplicationStateManager
|
|||||||
|
|
||||||
RunScriptWithOutputFile(script, $"{source} {destination} {args}", Path.Combine(Constants.DataFolder, "update-log.txt"));
|
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)
|
if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
||||||
Dispatcher.UIThread.Post(() => controlledApplicationLifetime.Shutdown());
|
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()
|
ProcessStartInfo info = new()
|
||||||
{
|
{
|
||||||
Arguments = $"\"{script}\" {arguments} {redirectSymbol} \"{outputFile}\"",
|
Arguments = $"\"{script}\" {arguments} > \"{outputFile}\"",
|
||||||
FileName = "/bin/bash",
|
FileName = "/bin/bash",
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user