Skip to content

Fix loading shell environment on Windows#21619

Merged
niik merged 1 commit intodevelopmentfrom
carriage-returns-are-the-bane-of-my-existence
Feb 13, 2026
Merged

Fix loading shell environment on Windows#21619
niik merged 1 commit intodevelopmentfrom
carriage-returns-are-the-bane-of-my-existence

Conversation

@niik
Copy link
Member

@niik niik commented Feb 13, 2026

Description

Replace fixed start/end marker strings with CRLF-tolerant regexes, locate the start marker via match and the last end marker via matchAll/at(-1), and update substring extraction accordingly. This prevents mis-parsing when shells emit extra stdout or use CRLF line endings and provides clearer error messages when markers are missing.

Screenshots

Release notes

Notes: [Fixed] Account for Windows EOL formatting when loading shell environment

Replace fixed start/end marker strings with CRLF-tolerant regexes, locate the start marker via match and the last end marker via matchAll/at(-1), and update substring extraction accordingly. This prevents mis-parsing when shells emit extra stdout or use CRLF line endings and provides clearer error messages when markers are missing.
@niik niik enabled auto-merge February 13, 2026 09:58
Copy link
Member

@sergiou87 sergiou87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Not needed for this PR, but… could we add some test coverage for this in a future PR? 🤔

@niik niik merged commit fa4fcf1 into development Feb 13, 2026
9 checks passed
@niik niik deleted the carriage-returns-are-the-bane-of-my-existence branch February 13, 2026 12:27
@niik
Copy link
Member Author

niik commented Feb 13, 2026

Yo @copilot, could you make a PR that does a smoke test of getShellEnv? We just want to make sure it it able to execute on both macOS and Windows. On Windows we should make sure that it works for all possible values of shellKind (i.e 'git-bash', 'pwsh', 'powershell', and 'cmd') and on macOS passing undefined should suffice. It'd be neat if we could get away with just one test that conditionalizes the shellKind parameter of getShellEnv based on the platform. Let's make sure that the returned environment contains a key that case-insensitively equates to PATH

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.

2 participants