Skip to content

Commit c229fc7

Browse files
[native_toolchain_c] Fix handle spaces in the path to the cl.exe compiler
When the Visual Studio C++ compiler (cl.exe) is installed in a path containing spaces (e.g., the default "C:\Program Files\Microsoft Visual Studio\2022\..."), the build system failed to execute it correctly. The command was invoked without proper quoting, leading to an error: 'C:\Program' is not recognized as an internal or external command This commit ensures that the path to cl.exe is properly quoted when invoking the compiler, allowing builds to succeed on systems with a standard Visual Studio installation.
1 parent bdc8062 commit c229fc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkgs/native_toolchain_c/lib/src/utils/run_process.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ Future<RunProcessResult> runProcess({
4141
arguments,
4242
workingDirectory: workingDirectory?.toFilePath(),
4343
environment: environment,
44-
runInShell: Platform.isWindows && workingDirectory != null,
44+
runInShell: executable.toFilePath().contains(' ')
45+
? false
46+
: Platform.isWindows && workingDirectory != null,
4547
);
4648

4749
final stdoutSub = process.stdout.listen((List<int> data) {

0 commit comments

Comments
 (0)