Fix auto-upgrade for AppImage

Trying to execute before make sure chmod is applied
This commit is contained in:
Tiago Conceição
2022-03-21 05:38:55 +00:00
parent 2627f20710
commit 75bfd9aa4c
2 changed files with 8 additions and 3 deletions
+5 -2
View File
@@ -13,6 +13,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
namespace UVtools.Core.SystemOS;
@@ -240,11 +241,13 @@ public static class SystemAware
}
public static void StartProcess(string name, string? arguments = null)
public static void StartProcess(string name, string? arguments = null, bool waitForCompletion = false, int waitTimeout = Timeout.Infinite)
{
try
{
using (Process.Start(new ProcessStartInfo(name, arguments!) { UseShellExecute = true })) { }
using var process = Process.Start(new ProcessStartInfo(name, arguments!) {UseShellExecute = true});
if (process is null) return;
if (waitForCompletion) process.WaitForExit(waitTimeout);
}
catch (Exception e)
{
+3 -1
View File
@@ -14,6 +14,7 @@ using System.Net.Http.Headers;
using System.Runtime.InteropServices;
using System.Text.Json.Nodes;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Avalonia.Threading;
using UVtools.Core;
@@ -223,7 +224,8 @@ public class AppVersionChecker : BindableBase
if (File.Exists(appImagePath)) File.Delete(appImagePath);
File.Move(DownloadedFile, newFullPath, true);
SystemAware.StartProcess("chmod", $"a+x \"{newFullPath}\"");
SystemAware.StartProcess("chmod", $"a+x \"{newFullPath}\"", true);
Thread.Sleep(500);
SystemAware.StartProcess(newFullPath);
}
else // others