@@ -534,24 +534,29 @@ private static Process StartProcess(BenchEnvironment env,
534534 throw new FileNotFoundException ( "The executable could not be found." , exe ) ;
535535 }
536536 var si = new ProcessStartInfo ( exe , arguments ) ;
537- si . UseShellExecute = false ;
538537 si . WorkingDirectory = cwd ;
539538 env . Load ( si . EnvironmentVariables ) ;
539+ si . UseShellExecute = false ;
540540 return Process . Start ( si ) ;
541541 }
542542
543543 private static Process StartProcessViaShell ( BenchEnvironment env ,
544- string cwd , string exe , string arguments ,
544+ string cwd , string exe , string arguments , string label = null ,
545545 ProcessWindowStyle windowStyle = ProcessWindowStyle . Normal )
546546 {
547547 if ( ! File . Exists ( exe ) )
548548 {
549549 throw new FileNotFoundException ( "The executable could not be found." , exe ) ;
550550 }
551- var si = new ProcessStartInfo ( exe , arguments ) ;
552- si . UseShellExecute = true ;
553- si . WindowStyle = windowStyle ;
551+ var args = $ "/C START \" { label } \" /D \" { cwd } \" ";
552+ if ( windowStyle == ProcessWindowStyle . Minimized ) args += " /MIN" ;
553+ args += $ " \" { exe } \" { arguments } ";
554+ var si = new ProcessStartInfo ( "cmd.exe" , args ) ;
555+ si . WindowStyle = ProcessWindowStyle . Hidden ;
556+ si . CreateNoWindow = true ;
554557 si . WorkingDirectory = cwd ;
558+ env . Load ( si . EnvironmentVariables ) ;
559+ si . UseShellExecute = false ;
555560 return Process . Start ( si ) ;
556561 }
557562
@@ -577,7 +582,7 @@ public static Process LaunchApp(BenchConfiguration config, BenchEnvironment env,
577582 throw new ArgumentException ( "The launcher executable is not set." ) ;
578583 }
579584 return StartProcessViaShell ( env , cwd ,
580- exe , CommandLine . SubstituteArgumentList ( app . LauncherArguments , args ) ,
585+ exe , CommandLine . SubstituteArgumentList ( app . LauncherArguments , args ) , app . Label ,
581586 isAdorned ? ProcessWindowStyle . Minimized : ProcessWindowStyle . Normal ) ;
582587 }
583588
0 commit comments