@@ -331,13 +331,6 @@ private int runContext(Context.Builder builder, CommandLineOptions config) {
331
331
try (Context context = builder .build ()) {
332
332
Metrics .printTime ("before-run" );
333
333
334
- Value rubyHome = context .eval (source (
335
- // language=ruby
336
- "Truffle::Boot.ruby_home" ));
337
- if (rubyHome .isString ()) {
338
- this .rubyHome = rubyHome .asString ();
339
- }
340
-
341
334
if (config .executionAction == ExecutionAction .PATH ) {
342
335
final Source source = source (// language=ruby
343
336
"-> name { Truffle::Boot.find_s_file(name) }" );
@@ -368,6 +361,17 @@ private int runContext(Context.Builder builder, CommandLineOptions config) {
368
361
final long argv = getNativeArgv ();
369
362
final String kind = config .executionAction .name ();
370
363
final int processStatus = context .eval (source ).execute (argc , argv , kind , config .toExecute ).asInt ();
364
+
365
+ if (ProcessStatus .isSignal (processStatus )) {
366
+ // Only fetch the ruby home when necessary, because chromeinspector tests
367
+ // currently only work with a single Context#eval.
368
+ Value rubyHome = context .eval (source (// language=ruby
369
+ "Truffle::Boot.ruby_home" ));
370
+ if (rubyHome .isString ()) {
371
+ this .rubyHome = rubyHome .asString ();
372
+ }
373
+ }
374
+
371
375
Metrics .printTime ("after-run" );
372
376
return processStatus ;
373
377
} catch (PolyglotException e ) {
0 commit comments