Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enhance quote to handle empty args #1113

Merged
merged 1 commit into from
Mar 1, 2025

Conversation

antongolub
Copy link
Collaborator

@antongolub antongolub commented Mar 1, 2025

closes #999
closes #1112

const _$ = $({ prefix: '', postfix: '' })
const p1 = _$`echo ${['-n', 'foo']}`
assert.equal(p1.cmd, 'echo -n foo')
assert.equal((await p1).toString(), 'foo')

const p2 = _$`echo ${[1, '', '*', '2']}`
assert.equal(p2.cmd, `echo 1 $'' $'*' 2`)
assert.equal((await p2).toString(), `1  * 2\n`)
  • Tests pass
  • Appropriate changes to README are included in PR

@antongolub antongolub requested a review from antonmedv March 1, 2025 16:42
@antonmedv antonmedv merged commit eff2d70 into google:main Mar 1, 2025
24 checks passed
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.

Empty string incorrectly not quoted in an array
2 participants