From 09eebd8c6997a33049084e307078717cc1a693a6 Mon Sep 17 00:00:00 2001 From: James Procter Date: Tue, 24 Jan 2023 07:48:54 +0000 Subject: [PATCH] =?utf8?q?JAL-629=20don=E2=80=99t=20carry=20on=20Jalview.mai?= =?utf8?q?n=20if=20we=E2=80=99ve=20already=20processed=20command=20line=20ar?= =?utf8?q?gs=20another=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/bin/Commands.java | 31 ++++++++++++++++++++++--------- src/jalview/bin/Jalview.java | 5 ++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 289d962..61ee1be 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -48,11 +48,11 @@ public class Commands private Map afMap; - public static void processArgs(ArgParser ap, boolean h) + public static boolean processArgs(ArgParser ap, boolean h) { argParser = ap; headless = h; - + boolean argsWereParsed = false; if (headless) { System.setProperty("java.awt.headless", "true"); @@ -73,14 +73,24 @@ public class Commands cmds.processLinked(id); } cmds.processImages(id); + argsWereParsed |= cmds.wereParsed(); } } if (argParser.getBool(Arg.QUIT)) { Jalview.getInstance().quit(); - // Desktop.instance.quit(); + return true; } + // carry on with jalview.bin.Jalview + return argsWereParsed; + } + + boolean argsWereParsed = false; + + private boolean wereParsed() + { + return argsWereParsed; } public Commands() @@ -328,12 +338,15 @@ public class Commands Console.error("Could not open any files in headless mode"); System.exit(1); } - } - else - { - Console.warn("No more files to open"); - if (desktop != null) - desktop.setProgressBar(null, progress); + // TOREMOVE COMMENT + // @Ben assumed this was the GUI version of above, rather then the + // first==false state + else + { + Console.warn("No more files to open"); + if (desktop != null) + desktop.setProgressBar(null, progress); + } } } diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 1f01125..6238c7d 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -565,7 +565,10 @@ public class Jalview if (argparser.isSet(Arg.HEADLESS)) headless = argparser.getBool(Arg.HEADLESS); - Commands.processArgs(argparser, headless); + if (Commands.processArgs(argparser, headless)) + { + System.exit(1); + } String file = null, data = null; FileFormatI format = null; -- 1.7.10.2