Repository navigation
Strip trailing CRLF from exec() output - #1316
Open
jsskeen-utah wants to merge 1 commit into
Open
jsskeen-utah wants to merge 1 commit into
jsskeen-utah wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound: removing one trailing LF or CRLF fixes the stray carriage return without trimming other whitespace.
Reviewed changes cover the resolver fix, regression test, and patch release entry.
- Output normalization:
exec()now removes a complete trailing CRLF or LF. - Regression coverage: a direct resolved-value assertion avoids the existing helper's carriage-return normalization; all 116 resolver tests passed on Node and Bun on Linux.
- Release note: documents the Windows line-ending fix.
gpt-6.1-sol | 𝕏
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
exec()removed only a trailing\n, so output with a CRLF line ending kept a stray\r. On Windows,Write-Outputproduces CRLF, soexec("powershell -NoProfile -Command \"Write-Output 'x'\"")resolved to"x\r". The fix removes one trailing LF or CRLF.The docs already say
exec()trims the extra newline that many CLI tools print, so this matches the documented behavior.Notes
functionValueTestshelper strips\rbefore comparing, which is why it didn't catch this bug.Testing
main(expected 'moo\r' to be 'moo') and passes with this change. I also packed this branch and installed the tarball:exec("printf 'pwsh-ok\r\n'")resolves topwsh-ok.exec()withpowershell -NoProfile -Command "Write-Output 'pwsh-ok'". Before the change the value ended in byte 13 (\r). After it, the value ispwsh-ok. This was a one-line patch to the installed file, not a run of the packed tarball, so the packed Windows build is still untested.