mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix: normalize command paths to base names in shellparse (#25599)
Normalize program names in shellparse.Parse to their basename. Does not rely on filepath.Base because the server may run on either Linux or Windows where the behavior would differ. Closes CODAGT-470
This commit is contained in:
committed by
GitHub
parent
5d40bac79f
commit
0ba702c43f
@@ -93,7 +93,22 @@ done`,
|
||||
{
|
||||
name: "quoted-program-name",
|
||||
in: `"/usr/bin/git" pull`,
|
||||
want: [][]string{{"/usr/bin/git", "pull"}},
|
||||
want: [][]string{{"git", "pull"}},
|
||||
},
|
||||
{
|
||||
name: "absolute-path-binary",
|
||||
in: `/opt/mise/data/installs/go/1.26.2/bin/go test ./...`,
|
||||
want: [][]string{{"go", "test"}},
|
||||
},
|
||||
{
|
||||
name: "relative-path-binary",
|
||||
in: `./build.sh --verbose`,
|
||||
want: [][]string{{"build.sh"}},
|
||||
},
|
||||
{
|
||||
name: "windows-path-binary",
|
||||
in: `'C:\Program Files\Go\bin\go.exe' test ./...`,
|
||||
want: [][]string{{"go.exe", "test"}},
|
||||
},
|
||||
{
|
||||
name: "double-quoted-with-variable-expansion-skipped",
|
||||
|
||||
Reference in New Issue
Block a user