Skip to content

Commit ffb4e1d

Browse files
devangpratapeffect-bot
authored andcommitted
Fix CommandLine.template accepting append assignments as the program (#9863)
Co-authored-by: Effect Bot <tech-ops@effectful.co>
1 parent 02e27f8 commit ffb4e1d

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": patch
3+
---
4+
5+
Reject an append assignment such as `FOO+=bar cmd` in `CommandLine.template` and `ChildProcess.make` with `UnsupportedSyntax`, as `FOO=bar cmd` already is, instead of running `FOO+=bar` as the program.

‎packages/effect/src/process/CommandLine.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ const operators = "|&;<>()"
499499
const globs = "*?["
500500
const expansionStart = /[A-Za-z_0-9{(@*#?$!'"-]/
501501
const quotedExpansionStart = /[A-Za-z_0-9{(@*#?$!-]/
502-
const assignmentName = /^[A-Za-z_][A-Za-z0-9_]*$/
502+
const assignmentName = /^[A-Za-z_][A-Za-z0-9_]*\+?$/
503503

504504
const isBlank = (char: string | undefined): boolean => char === " " || char === "\t" || char === "\n"
505505

‎packages/effect/test/process/CommandLine.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ describe("CommandLine", () => {
169169
["echo a{1..3}", "UnsupportedSyntax"],
170170
["=ls", "UnsupportedSyntax"],
171171
["FOO=bar cmd", "UnsupportedSyntax"],
172+
["FOO+=bar cmd", "UnsupportedSyntax"],
172173
["'open", "UnterminatedQuote"],
173174
["a \"b", "UnterminatedQuote"],
174175
["a\\", "InvalidEscape"]

0 commit comments

Comments
 (0)