diff --git a/java/net/i2p/router/WinUpdateProcess.java b/java/net/i2p/router/WinUpdateProcess.java new file mode 100644 index 0000000..5dfa30b --- /dev/null +++ b/java/net/i2p/router/WinUpdateProcess.java @@ -0,0 +1,35 @@ +package net.i2p.router; + +import net.i2p.router.*; +import net.i2p.I2PAppContext; + +import java.util.function.*; +import java.io.*; +import net.i2p.util.Log; + +class WinUpdateProcess implements Runnable { + private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(WinUpdateProcess.class); + private final RouterContext ctx; + private final Supplier versionSupplier; + private final File file = null; + + WinUpdateProcess(RouterContext ctx, Supplier versionSupplier, File file) { + this.ctx = ctx; + this.versionSupplier = versionSupplier; + } + + private void runUpdateInstaller(File file){ + ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath(), "/S"); + try { + pb.start(); + } catch (IOException ex) { + if (_log.shouldWarn()) + _log.warn("Unable to run update-program in background. Update will fail."); + } + } + + @Override + public void run() { + runUpdateInstaller(file); + } +}