Skip to content

[native_toolchain_c] Fix Windows env quoting in runProcess (#3321)#3329

Open
Chaos02 wants to merge 1 commit intodart-lang:mainfrom
Chaos02:fix/run-process-windows-env-quoting-3321
Open

[native_toolchain_c] Fix Windows env quoting in runProcess (#3321)#3329
Chaos02 wants to merge 1 commit intodart-lang:mainfrom
Chaos02:fix/run-process-windows-env-quoting-3321

Conversation

@Chaos02
Copy link
Copy Markdown

@Chaos02 Chaos02 commented Apr 23, 2026

On Windows, runProcess launched the subprocess with runInShell: true whenever a workingDirectory was supplied. The shell re-parsed every entry in the supplied environment map, so values containing spaces or quotes (common for PATH, INCLUDE, LIB entries from MSVC environment batch files) were corrupted before reaching the child process.

This PR:

  • Drops runInShell unconditionally — the child now receives environment verbatim from dart:io's Process.start.
  • Adds _quoteForCommandLog, which quotes env values containing whites

Related Issues

Fixes #3321

PR Checklist

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
  • I've run dart tool/ci.dart --all locally and resolved all issues identified. This ensures the PR is formatted, has no lint errors, and ran all code generators. This applies to the packages part of the toplevel pubspec.yaml workspace.
  • All existing and new tests are passing. I added new tests to check the change I am making.
  • The PR is actually solving the issue. PRs that don't solve the issue will be closed. Please be respectful of the maintainers' time. If it's not clear what the issue is, feel free to ask questions on the GitHub issue before submitting a PR.
  • I have updated CHANGELOG.md for the relevant packages. (Not needed for small changes such as doc typos).
  • I have updated the pubspec package version if necessary.

@dcharkes
Copy link
Copy Markdown
Collaborator

This PR seems similar to #3323, but this is about env vars instead of the executable path.

As discussed in that PR, we had issues before with invoking tools on Windows, and that's why the runInShell was added. We can try removing it, but it might lead to those issues returning. Is there a way to make it work without changing runInShell? Or is removing runInShell the only fix?

@github-actions
Copy link
Copy Markdown

Package publishing

Package Version Status Publish tag (post-merge)
package:code_assets 1.0.0 already published at pub.dev
package:data_assets 0.19.6 already published at pub.dev
package:ffi 2.2.0 already published at pub.dev
package:hooks 1.0.3 already published at pub.dev
package:hooks_runner 1.2.1 already published at pub.dev
package:jni_flutter 1.0.1 already published at pub.dev
package:native_toolchain_c 0.18.1 ready to publish native_toolchain_c-v0.18.1
package:record_use 0.6.1-wip WIP (no publish necessary)
package:swift2objc 0.2.0-wip WIP (no publish necessary)
package:swiftgen 0.1.2 already published at pub.dev

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

@github-actions
Copy link
Copy Markdown

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
native_toolchain_c None 0.18.0 0.18.1 0.18.0 ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows build fails when Visual Studio is installed in default path (spaces in Program Files)

2 participants