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