Fix updater being broken after restart

This commit is contained in:
crschnick
2025-09-06 15:20:38 +00:00
parent b181ba5412
commit e0bd8f802c
3 changed files with 15 additions and 8 deletions

View File

@@ -272,12 +272,15 @@ public abstract class OperationMode {
return;
}
inShutdown = true;
try {
if (CURRENT != null) {
CURRENT.finalTeardown();
if (!isInStartup()) {
inShutdown = true;
if (CURRENT != null) {
CURRENT.finalTeardown();
}
CURRENT = null;
}
CURRENT = null;
// Restart local shell
LocalShell.init();
r.run();

View File

@@ -35,15 +35,17 @@ public class AppDownloads {
}
var downloadFile = FileUtils.getTempDirectory().toPath().resolve(release.getFile());
Files.write(downloadFile, response.body());
// Fix file name to not be included in temp dir clean
var fixedFile = Path.of(downloadFile.toString().replaceAll("-", "_"));
Files.write(fixedFile, response.body());
TrackEvent.withInfo("Downloaded asset")
.tag("version", version)
.tag("url", release.getUrl())
.tag("size", FileUtils.byteCountToDisplaySize(response.body().length))
.tag("target", downloadFile)
.tag("target", fixedFile)
.handle();
return downloadFile;
return fixedFile;
} catch (IOException ex) {
// All sorts of things can go wrong when downloading, this is expected
ErrorEventFactory.expected(ex);

View File

@@ -15,7 +15,9 @@ public class LocalShell {
private static boolean powershellInitialized;
public static synchronized void init() throws Exception {
local = ProcessControlProvider.get().createLocalProcessControl(false).start();
if (local == null) {
local = ProcessControlProvider.get().createLocalProcessControl(false).start();
}
}
public static synchronized void reset(boolean force) {