Skip to content

Commit 5903ec8

Browse files
committed
cmd/cue: test tool/exec.Run with arguments involving spaces
The command is expected to fail, as we run the "false" program which always fails and ignores any arguments. The printed error is ambiguous, as it's not possible to see what the original list of arguments was, hence the TODO. The following commit will resolve this bug. For #3238. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Ie277772ce58dfac48df9440e0a53fd9f1fc309cc Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1197451 Reviewed-by: Roger Peppe <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 95802d3 commit 5903ec8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

cmd/cue/cmd/testdata/script/cmd_errcode.txtar

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ command: errcode: {
1616
kind: "exec"
1717
cmd: "ls --badflags"
1818
stderr: string // suppress error message
19-
}}
19+
}
20+
}

cmd/cue/cmd/testdata/script/cmd_execerr.txtar

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ cmp stderr cannotFail-stderr.golden
44
exec cue cmd canFail
55
cmp stdout canFail-stdout.golden
66

7+
# TODO(mvdan): the error message should quote the argument list
8+
# so that any arguments with spaces do not introduce ambiguity.
9+
! exec cue cmd withSpaces
10+
cmp stderr withSpaces-stderr.golden
11+
712
-- cue.mod/module.cue --
813
module: "example.com"
914
language: version: "v0.9.0"
@@ -18,6 +23,8 @@ hasStderr=false
1823
errNotFound:
1924
success=false
2025
hasStderr=true
26+
-- withSpaces-stderr.golden --
27+
task failed: command "false with an ignored argument" failed: exit status 1
2128
-- foo_tool.cue --
2229
package foo
2330

@@ -55,3 +62,7 @@ command: canFail: {
5562
"""
5663
}
5764
}
65+
66+
command: withSpaces: exec.Run & {
67+
cmd: ["false", "with an ignored argument"]
68+
}

0 commit comments

Comments
 (0)