Skip to content

fix: wrap cmd in subshell to fix ::set-teamsfx-env not captured on Linux when script uses semicolons#15818

Merged
qfai merged 1 commit intodevfrom
copilot/fix-set-teamsfx-env-linux-semicolon
Apr 29, 2026
Merged

fix: wrap cmd in subshell to fix ::set-teamsfx-env not captured on Linux when script uses semicolons#15818
qfai merged 1 commit intodevfrom
copilot/fix-set-teamsfx-env-linux-semicolon

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

When cmd contains semicolons (common in YAML multi-line run: blocks), bash parses them as command separators — causing each echo to run standalone without the tee redirect. The temp file stays empty, parseSetOutputCommand returns {}, and no env vars are set.

Change

Wrap ${cmd} in a subshell so bash treats its entire content as one unit piped through tee:

- scriptContent = `#!/bin/bash\nset +e\n${cmd} 2>&1 | tee "${tempFile}"\nexit \${PIPESTATUS[0]}\n`;
+ scriptContent = `#!/bin/bash\nset +e\n( ${cmd} ) 2>&1 | tee "${tempFile}"\nexit \${PIPESTATUS[0]}\n`;

Only the Linux/bash path is affected; the PowerShell path already uses a & { ... } block for the same reason.

@qfai qfai marked this pull request as ready for review April 29, 2026 06:20
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.32%. Comparing base (92c0382) to head (e3f357c).
⚠️ Report is 5 commits behind head on dev.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##              dev   #15818   +/-   ##
=======================================
  Coverage   93.32%   93.32%           
=======================================
  Files         587      587           
  Lines       37120    37120           
  Branches     6903     6960   +57     
=======================================
  Hits        34641    34641           
  Misses       1835     1835           
  Partials      644      644           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@qfai qfai merged commit 5b7baae into dev Apr 29, 2026
95 of 107 checks passed
@qfai qfai deleted the copilot/fix-set-teamsfx-env-linux-semicolon branch April 29, 2026 11:16
wh-alice added a commit that referenced this pull request Apr 29, 2026
…to-release-6.9

fix: wrap cmd in subshell to fix ::set-teamsfx-env on Linux with semicolons (#15818)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants