fix: avoid panic after calling WordsSeq (#2810)

This commit is contained in:
Timothy Rule
2026-05-09 23:42:00 +02:00
committed by GitHub
parent de05ebc503
commit 9e3ff27ba1
2 changed files with 5 additions and 1 deletions

View File

@@ -13,6 +13,7 @@
`:` elsewhere (#2406, #2408 by @solvingj).
- Update the shell interpreter with a regression fix (#2812, #2832 by
@andreynering).
- Fix potential panic with the shell interpreter (#2810 by @trulede).
## v3.50.0 - 2026-04-13

View File

@@ -127,7 +127,10 @@ func ExpandFields(s string) ([]string, error) {
s = escape(s)
p := syntax.NewParser()
var words []*syntax.Word
for w := range p.WordsSeq(strings.NewReader(s)) {
for w, err := range p.WordsSeq(strings.NewReader(s)) {
if err != nil {
return nil, err
}
words = append(words, w)
}
cfg := &expand.Config{