Skip to content

Commit 4f8a592

Browse files
committed
Fix exit code for OpenGrok script. Fix Indexer "usage".
('/' is used in "usage" for paths, so don't use to separate choices.)
1 parent df247ee commit 4f8a592

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

OpenGrok

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
# options for CTags program (for its --options
4444
# switch), default is DATA_ROOT/etc/ctags.config
4545
# - OPENGROK_MANDOC Full path to mandoc(1) binary
46+
# - OPENGROK_LOCKING Lucene SimpleFSLockFactory on|off (default off)
4647
# - JAVA_HOME Full Path to Java Installation Root
4748
# - JAVA Full Path to java binary (to enable 64bit JDK)
4849
# - JAVA_OPTS Java options (e.g. for JVM memory increase
@@ -855,6 +856,7 @@ CommonInvocation()
855856
${RENAMED_FILES_HISTORY} \
856857
${SCAN_DEPTH} \
857858
${PROGRESS} \
859+
${OPENGROK_LOCKING:+--lock} ${OPENGROK_LOCKING} \
858860
${OPENGROK_CTAGS:+-c} ${OPENGROK_CTAGS} \
859861
${OPENGROK_MANDOC:+--mandoc} ${OPENGROK_MANDOC} \
860862
${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
@@ -1032,17 +1034,15 @@ case "${1}" in
10321034
update)
10331035
ValidateConfiguration
10341036
CreateRuntimeRequirements
1035-
UpdateGeneratedData
1036-
UpdateDescriptionCache
1037+
UpdateGeneratedData && UpdateDescriptionCache
10371038
;;
10381039

10391040
updateQuietly)
10401041
ValidateConfiguration
10411042
CreateRuntimeRequirements
10421043
QUIET="-q"
10431044
VERBOSE=""
1044-
UpdateGeneratedData
1045-
UpdateDescriptionCache
1045+
UpdateGeneratedData && UpdateDescriptionCache
10461046
;;
10471047

10481048
updateDesc)
@@ -1066,8 +1066,7 @@ case "${1}" in
10661066
fi
10671067
ValidateConfiguration
10681068
CreateRuntimeRequirements
1069-
UpdateGeneratedData
1070-
UpdateDescriptionCache
1069+
UpdateGeneratedData && UpdateDescriptionCache
10711070
;;
10721071

10731072
indexpart)
@@ -1105,3 +1104,4 @@ case "${1}" in
11051104
Usage
11061105
;;
11071106
esac
1107+
exit $?

src/org/opensolaris/opengrok/index/Indexer.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ public static void main(String argv[]) {
276276

277277
} catch (ParseException e) {
278278
System.err.println("** " +e.getMessage());
279+
System.exit(1);
279280
} catch (IndexerException ex) {
280281
LOGGER.log(Level.SEVERE, "Exception running indexer", ex);
281282
System.err.println(openGrok.getUsage());
@@ -339,8 +340,8 @@ public static WebAddress parseWebAddress(String webAddr) {
339340
public static String[] parseOptions(String[] argv) throws ParseException {
340341
String[] usage = { "--help" };
341342
String program = "opengrok.jar";
342-
String[] onOff = {ON, OFF};
343-
String[] remoteRepoChoices = {ON, OFF, DIRBASED, UIONLY};
343+
final String[] ON_OFF = {ON, OFF};
344+
final String[] REMOTE_REPO_CHOICES = {ON, OFF, DIRBASED, UIONLY};
344345

345346
if (argv.length == 0) {
346347
argv = usage; // will force usage output
@@ -467,12 +468,12 @@ public static String[] parseOptions(String[] argv) throws ParseException {
467468
cfg.getIgnoredNames().add((String)pattern);
468469
});
469470

470-
parser.on("-l", "--lock", "=on/off", onOff, Boolean.class,
471-
"Turn on/off locking of the Lucene database during index generation.").Do( v -> {
471+
parser.on("-l", "--lock", "=on|off", ON_OFF, Boolean.class,
472+
"Turn on|off locking of the Lucene database during index generation.").Do( v -> {
472473
cfg.setUsingLuceneLocking((Boolean)v);
473474
});
474475

475-
parser.on("--leadingWildCards", "=on/off", onOff, Boolean.class,
476+
parser.on("--leadingWildCards", "=on|off", ON_OFF, Boolean.class,
476477
"Allow or disallow leading wildcards in a search.").Do( v -> {
477478
cfg.setAllowLeadingWildcard((Boolean)v);
478479
});
@@ -510,7 +511,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
510511
runIndex = false;
511512
});
512513

513-
parser.on("-O", "--optimize", "=on/off", onOff, Boolean.class,
514+
parser.on("-O", "--optimize", "=on|off", ON_OFF, Boolean.class,
514515
"Turn on/off the optimization of the index database",
515516
"as part of the indexing step.").
516517
Do( v -> {
@@ -560,7 +561,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
560561
}
561562
);
562563

563-
parser.on("-Q", "--quickScan", "=on/off", onOff, Boolean.class,
564+
parser.on("-Q", "--quickScan", "=on|off", ON_OFF, Boolean.class,
564565
"Turn on/off quick context scan. By default, only the first",
565566
"1024k of a file is scanned, and a '[..all..]' link is inserted",
566567
"when the file is bigger. Activating this may slow the server down.",
@@ -578,7 +579,8 @@ public static String[] parseOptions(String[] argv) throws ParseException {
578579
// Already handled above. This populates usage.
579580
});
580581

581-
parser.on("-r", "--remote", "=on|off|uionly|dirbased", remoteRepoChoices,
582+
parser.on("-r", "--remote", "=on|off|uionly|dirbased",
583+
REMOTE_REPO_CHOICES,
582584
"Specify support for remote SCM systems.",
583585
" on - allow retrieval for remote SCM systems.",
584586
" off - ignore SCM for remote systems.",
@@ -599,7 +601,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
599601
}
600602
);
601603

602-
parser.on("--renamedHistory", "=on/off", onOff, Boolean.class,
604+
parser.on("--renamedHistory", "=on|off", ON_OFF, Boolean.class,
603605
"Enable or disable generating history for renamed files.",
604606
"If set to on, makes history indexing slower for repositories",
605607
"with lots of renamed files.").Do( v -> {

0 commit comments

Comments
 (0)