@@ -57,8 +57,8 @@ protected void validateArguments(Map<String, String> polyglotOptions) {
57
57
58
58
@ Override
59
59
protected void printVersion () {
60
- System . out .println (TruffleRuby .getVersionString (getImplementationNameFromEngine ()));
61
- System . out .println ();
60
+ getOutput () .println (TruffleRuby .getVersionString (getImplementationNameFromEngine ()));
61
+ getOutput () .println ();
62
62
printPolyglotVersions ();
63
63
}
64
64
@@ -112,9 +112,9 @@ protected List<String> preprocessArguments(List<String> args, Map<String, String
112
112
}
113
113
114
114
} catch (CommandLineException commandLineException ) {
115
- System . err .println ("truffleruby: " + commandLineException .getMessage ());
115
+ getError () .println ("truffleruby: " + commandLineException .getMessage ());
116
116
if (commandLineException .isUsageError ()) {
117
- printHelp (System . err );
117
+ printHelp (getError () );
118
118
}
119
119
System .exit (1 );
120
120
}
@@ -228,7 +228,7 @@ private int runRubyMain(Context.Builder contextBuilder, CommandLineOptions confi
228
228
case IRB :
229
229
config .executionAction = ExecutionAction .PATH ;
230
230
if (System .console () != null ) {
231
- System . err .println (
231
+ getError () .println (
232
232
"[ruby] WARNING: truffleruby starts IRB when stdin is a TTY instead of reading from stdin, use '-' to read from stdin" );
233
233
config .executionAction = ExecutionAction .PATH ;
234
234
config .toExecute = "irb" ;
@@ -247,7 +247,7 @@ private int runRubyMain(Context.Builder contextBuilder, CommandLineOptions confi
247
247
// Apply options to run gem/bundle more efficiently
248
248
contextBuilder .option ("engine.Mode" , "latency" );
249
249
if (Boolean .getBoolean ("truffleruby.launcher.log" )) {
250
- System . err .println ("[ruby] CONFIG: detected gem or bundle command, using --engine.Mode=latency" );
250
+ getError () .println ("[ruby] CONFIG: detected gem or bundle command, using --engine.Mode=latency" );
251
251
}
252
252
}
253
253
@@ -285,7 +285,7 @@ private int runContext(Context.Builder builder, CommandLineOptions config) {
285
285
if (file .isString ()) {
286
286
config .toExecute = file .asString ();
287
287
} else {
288
- System . err
288
+ getError ()
289
289
.println ("truffleruby: No such file or directory -- " + config .toExecute + " (LoadError)" );
290
290
return 1 ;
291
291
}
@@ -314,9 +314,9 @@ private int runContext(Context.Builder builder, CommandLineOptions config) {
314
314
return exitCode ;
315
315
} catch (PolyglotException e ) {
316
316
if (e .isHostException ()) { // GR-22071
317
- System . err .println ("truffleruby: a host exception reached the top level:" );
317
+ getError () .println ("truffleruby: a host exception reached the top level:" );
318
318
} else {
319
- System . err .println (
319
+ getError () .println (
320
320
"truffleruby: an exception escaped out of the interpreter - this is an implementation bug" );
321
321
}
322
322
e .printStackTrace ();
@@ -359,21 +359,21 @@ private static String getPagerFromEnv() {
359
359
360
360
private void printPreRunInformation (CommandLineOptions config ) {
361
361
if (config .showVersion ) {
362
- System . out .println (TruffleRuby .getVersionString (getImplementationNameFromEngine ()));
362
+ getOutput () .println (TruffleRuby .getVersionString (getImplementationNameFromEngine ()));
363
363
}
364
364
365
365
if (config .showCopyright ) {
366
- System . out .println (TruffleRuby .RUBY_COPYRIGHT );
366
+ getOutput () .println (TruffleRuby .RUBY_COPYRIGHT );
367
367
}
368
368
369
369
switch (config .showHelp ) {
370
370
case NONE :
371
371
break ;
372
372
case SHORT :
373
- printShortHelp (System . out );
373
+ printShortHelp (getOutput () );
374
374
break ;
375
375
case LONG :
376
- printHelp (System . out );
376
+ printHelp (getOutput () );
377
377
break ;
378
378
}
379
379
}
0 commit comments