@@ -351,16 +351,6 @@ public static final class AppOutputVerifier {
351351 this .outputFilePath = TKit .workDir ().resolve (OUTPUT_FILENAME );
352352 this .params = new HashMap <>();
353353 this .defaultLauncherArgs = new ArrayList <>();
354-
355- if (TKit .isWindows ()) {
356- // When running app launchers on Windows, clear users environment (JDK-8254920)
357- removePath (true );
358- }
359- }
360-
361- public AppOutputVerifier removePath (boolean v ) {
362- removePath = v ;
363- return this ;
364354 }
365355
366356 public AppOutputVerifier saveOutput (boolean v ) {
@@ -442,10 +432,7 @@ public Executor.Result execute(String... args) {
442432 if (launcherNoExit ) {
443433 return getExecutor (args ).executeWithoutExitCodeCheck ();
444434 } else {
445- final int attempts = 3 ;
446- final int waitBetweenAttemptsSeconds = 5 ;
447- return getExecutor (args ).executeAndRepeatUntilExitCode (expectedExitCode , attempts ,
448- waitBetweenAttemptsSeconds );
435+ return HelloApp .execute (expectedExitCode , getExecutor (args ));
449436 }
450437 }
451438
@@ -475,7 +462,6 @@ private Executor getExecutor(String...args) {
475462 }
476463
477464 private boolean launcherNoExit ;
478- private boolean removePath ;
479465 private boolean saveOutput ;
480466 private final Path launcherPath ;
481467 private Path outputFilePath ;
@@ -488,7 +474,22 @@ public static AppOutputVerifier assertApp(Path helloAppLauncher) {
488474 return new AppOutputVerifier (helloAppLauncher );
489475 }
490476
491- public static Executor configureEnvironment (Executor executor ) {
477+ public static Executor .Result configureAndExecute (int expectedExitCode , Executor executor ) {
478+ return execute (expectedExitCode , configureEnvironment (executor ));
479+ }
480+
481+ private static Executor .Result execute (int expectedExitCode , Executor executor ) {
482+ if (TKit .isLinux ()) {
483+ final int attempts = 3 ;
484+ final int waitBetweenAttemptsSeconds = 5 ;
485+ return executor .executeAndRepeatUntilExitCode (expectedExitCode , attempts ,
486+ waitBetweenAttemptsSeconds );
487+ } else {
488+ return executor .execute (expectedExitCode );
489+ }
490+ }
491+
492+ private static Executor configureEnvironment (Executor executor ) {
492493 if (CLEAR_JAVA_ENV_VARS ) {
493494 executor .removeEnvVar ("JAVA_TOOL_OPTIONS" );
494495 executor .removeEnvVar ("_JAVA_OPTIONS" );
0 commit comments