@@ -75,7 +75,8 @@ class WSLApi {
7575 {String startPath = '' ,
7676 String startUser = '' ,
7777 String startCmd = '' }) async {
78- List <String > args = ['wsl' , '-d' , distribution];
78+ List <String > args = [];
79+ args.addAll (['wsl' , '-d' , distribution]);
7980 if (startPath != '' ) {
8081 args.addAll (['--cd' , startPath]);
8182 }
@@ -91,7 +92,6 @@ class WSLApi {
9192 }
9293 await Process .start ('start' , args,
9394 mode: ProcessStartMode .detached, runInShell: true );
94-
9595 if (kDebugMode) {
9696 print ("Done starting $distribution " );
9797 }
@@ -201,12 +201,15 @@ class WSLApi {
201201 mode: ProcessStartMode .normal, runInShell: true );
202202 }
203203
204- /// Start Windows Terminal\
205- /// *(falls back to PowerShell on exception)*
204+ /// Start Windows Terminal or PowerShell
206205 void startWindowsTerminal (String distribution) async {
207206 List <String > launchWslHome = ['wsl' , '-d' , distribution, '--cd' , '~' ];
208207 try {
209- await Process .start ('wt' , launchWslHome);
208+ // Run windows terminal in same window wt -w 0 nt
209+ var args = ['wt' , '-w' , '0' , 'nt' ];
210+ args.addAll (launchWslHome);
211+
212+ await Process .run ('start' , args);
210213 } catch (_) {
211214 // Windows Terminal not installed
212215 Notify .message ('openwithwt-not-found-error' .i18n ());
0 commit comments