Use a debug system property to control debugging.

When set, it disables stdout/stderr redirection and uses java.exe on Windows so
that a console window is shown with output from the launched app.

This removes the use of a debug.txt file.
This commit is contained in:
Michael Bayne
2019-05-29 14:09:17 -07:00
parent 7f305df410
commit b5377ca66b
3 changed files with 10 additions and 7 deletions
@@ -784,10 +784,6 @@ public class Application
// extract some info used to configure our child process on macOS
_dockName = config.getString("ui.name");
_dockIconPath = config.getString("ui.mac_dock_icon", "../desktop.icns");
// look for a debug.txt file which causes us to run in java.exe on Windows so that we can
// obtain a thread dump of the running JVM
_windebug = getLocalPath("debug.txt").exists();
}
/**
@@ -967,7 +963,7 @@ public class Application
ArrayList<String> args = new ArrayList<>();
// reconstruct the path to the JVM
args.add(LaunchUtil.getJVMBinaryPath(_javaLocalDir, _windebug || optimum));
args.add(LaunchUtil.getJVMBinaryPath(_javaLocalDir, SysProps.debug() || optimum));
// check whether we're using -jar mode or -classpath mode
boolean dashJarMode = MANIFEST_CLASS.equals(_class);
@@ -1737,7 +1733,6 @@ public class Application
protected String _dockName;
protected String _dockIconPath;
protected boolean _strictComments;
protected boolean _windebug;
protected boolean _allowOffline;
protected int _maxConcDownloads;
@@ -40,6 +40,14 @@ public final class SysProps
return System.getProperty("no_log_redir") != null;
}
/** Used to debug Getdown's launching of an app. When set, it disables redirection of stdout
* and stderr into a log file, and on Windows it uses {@code java.exe} to launch the app so
* that its console output can be observed.
* Usage: {@code -Ddebug}. */
public static boolean debug () {
return System.getProperty("debug") != null;
}
/** Overrides the domain on {@code appbase}. Usage: {@code -Dappbase_domain=foo}. */
public static String appbaseDomain () {
return System.getProperty("appbase_domain");