mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-12 02:05:50 +00:00
Fix args not being propagated by AutoUpdate to ApplyUpdate. Also propagate ALL command-line args, not just args[0]
This commit is contained in:
parent
62ed4e322b
commit
e9c94eb83b
@ -151,9 +151,8 @@ public class ApplyUpdate {
|
||||
// Call mainClass in JAR
|
||||
javaCmd.addAll(Arrays.asList("-jar", JAR_FILENAME));
|
||||
|
||||
if (args.length > 0)
|
||||
// Add settings filename
|
||||
javaCmd.add(args[0]);
|
||||
// Add saved command-line args
|
||||
javaCmd.addAll(Arrays.asList(args));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -236,10 +236,10 @@ public class AutoUpdate extends Thread {
|
||||
// Call ApplyUpdate using new JAR
|
||||
javaCmd.addAll(Arrays.asList("-cp", NEW_JAR_FILENAME, ApplyUpdate.class.getCanonicalName()));
|
||||
|
||||
// Are we running with different settings?
|
||||
String settingsFilename = Controller.getInstance().getSettingsFilename();
|
||||
if (settingsFilename != null)
|
||||
javaCmd.add(settingsFilename);
|
||||
// Add command-line args saved from start-up
|
||||
String[] savedArgs = Controller.getInstance().getSavedArgs();
|
||||
if (savedArgs != null)
|
||||
javaCmd.addAll(Arrays.asList(savedArgs));
|
||||
|
||||
LOGGER.info(String.format("Applying update with: %s", String.join(" ", javaCmd)));
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class Controller extends Thread {
|
||||
|
||||
private final String buildVersion;
|
||||
private final long buildTimestamp; // seconds
|
||||
private String settingsFilename;
|
||||
private final String[] savedArgs;
|
||||
|
||||
private AtomicReference<BlockData> chainTip = new AtomicReference<>();
|
||||
|
||||
@ -163,7 +163,7 @@ public class Controller extends Thread {
|
||||
|
||||
// Constructors
|
||||
|
||||
private Controller() {
|
||||
private Controller(String[] args) {
|
||||
Properties properties = new Properties();
|
||||
try (InputStream in = this.getClass().getResourceAsStream("/build.properties")) {
|
||||
properties.load(in);
|
||||
@ -184,11 +184,18 @@ public class Controller extends Thread {
|
||||
|
||||
this.buildVersion = VERSION_PREFIX + buildVersionProperty;
|
||||
LOGGER.info(String.format("Build version: %s", this.buildVersion));
|
||||
|
||||
this.savedArgs = args;
|
||||
}
|
||||
|
||||
public static Controller getInstance() {
|
||||
private static Controller newInstance(String[] args) {
|
||||
instance = new Controller(args);
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static synchronized Controller getInstance() {
|
||||
if (instance == null)
|
||||
instance = new Controller();
|
||||
instance = new Controller(null);
|
||||
|
||||
return instance;
|
||||
}
|
||||
@ -230,8 +237,8 @@ public class Controller extends Thread {
|
||||
return this.blockchainLock;
|
||||
}
|
||||
|
||||
/* package */ String getSettingsFilename() {
|
||||
return this.settingsFilename;
|
||||
/* package */ String[] getSavedArgs() {
|
||||
return this.savedArgs;
|
||||
}
|
||||
|
||||
// Entry point
|
||||
@ -294,7 +301,7 @@ public class Controller extends Thread {
|
||||
}
|
||||
|
||||
LOGGER.info("Starting controller");
|
||||
Controller.getInstance().start();
|
||||
Controller.newInstance(args).start();
|
||||
|
||||
LOGGER.info(String.format("Starting networking on port %d", Settings.getInstance().getListenPort()));
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user