Skip to content

Commit b9e9375

Browse files
committed
Reformat condition
1 parent 5561033 commit b9e9375

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

src/launcher/java/org/truffleruby/launcher/RubyLauncher.java

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -188,33 +188,29 @@ protected boolean parseCommonOption(String defaultOptionPrefix, Map<String, Stri
188188

189189
@Override
190190
protected boolean runLauncherAction() {
191-
if (!helpOptionUsed || System.console() == null) {
192-
return super.runLauncherAction();
193-
}
194-
195-
String pager = getPagerFromEnv();
196-
if (pager.isEmpty()) {
191+
String pager;
192+
if (helpOptionUsed && System.console() != null && !(pager = getPagerFromEnv()).isEmpty()) {
193+
try {
194+
Process process = new ProcessBuilder(pager)
195+
.redirectOutput(Redirect.INHERIT)
196+
.redirectErrorStream(true)
197+
.start();
198+
PrintStream out = new PrintStream(process.getOutputStream());
199+
200+
setOutput(out);
201+
boolean code = super.runLauncherAction();
202+
203+
out.flush();
204+
out.close();
205+
process.waitFor();
206+
207+
return code;
208+
} catch (IOException | InterruptedException e) {
209+
throw abort(e);
210+
}
211+
} else {
197212
return super.runLauncherAction();
198213
}
199-
200-
try {
201-
Process process = new ProcessBuilder(pager)
202-
.redirectOutput(Redirect.INHERIT)
203-
.redirectErrorStream(true)
204-
.start();
205-
PrintStream out = new PrintStream(process.getOutputStream());
206-
207-
setOutput(out);
208-
boolean code = super.runLauncherAction();
209-
210-
out.flush();
211-
out.close();
212-
process.waitFor();
213-
214-
return code;
215-
} catch (IOException | InterruptedException e) {
216-
throw abort(e);
217-
}
218214
}
219215

220216
private int runRubyMain(Context.Builder contextBuilder, CommandLineOptions config) {

0 commit comments

Comments
 (0)