From 66a77507ee84d2c34113107243042566d4f8222a Mon Sep 17 00:00:00 2001 From: Victor Chernikh Date: Wed, 10 Apr 2024 12:14:44 +0200 Subject: [PATCH] fix: make command run for Windows in shell due to specific behavior of `Process.start` for Windows [Windows issues of running flutterw](https://github.com/hyiso/flutterw/issues/19) --- packages/flutterw/lib/src/shell.dart | 2 ++ packages/flutterw_build_aar/bin/flutterw_build_aar.dart | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/flutterw/lib/src/shell.dart b/packages/flutterw/lib/src/shell.dart index 1cfff22..da33a7e 100644 --- a/packages/flutterw/lib/src/shell.dart +++ b/packages/flutterw/lib/src/shell.dart @@ -9,6 +9,7 @@ Future runFlutter(List arguments) async { final process = await Process.start( 'flutter', arguments, + runInShell: Platform.isWindows, mode: ProcessStartMode.inheritStdio, ); final code = await process.exitCode; @@ -40,6 +41,7 @@ Future runShells( final process = await Process.start( cmds.removeAt(0), cmds, + runInShell: Platform.isWindows, mode: isVerbose ? ProcessStartMode.inheritStdio : ProcessStartMode.normal, ); final code = await process.exitCode; diff --git a/packages/flutterw_build_aar/bin/flutterw_build_aar.dart b/packages/flutterw_build_aar/bin/flutterw_build_aar.dart index 8c5466a..d2f9c4d 100644 --- a/packages/flutterw_build_aar/bin/flutterw_build_aar.dart +++ b/packages/flutterw_build_aar/bin/flutterw_build_aar.dart @@ -24,7 +24,11 @@ void main(List arguments) async { arguments.replaceRange( index + 1, index + 2, [pubspec.version!.canonicalizedVersion]); } - final process = await Process.start('flutter', ['build', 'aar', ...arguments], - mode: ProcessStartMode.inheritStdio); + final process = await Process.start( + 'flutter', + ['build', 'aar', ...arguments], + runInShell: Platform.isWindows, + mode: ProcessStartMode.inheritStdio, + ); exitCode = await process.exitCode; }