Skip to content

Commit cc0e2d5

Browse files
author
Shukui Yang
committed
Remove the workaround which add a -- flag to runc exec command and add integration for exec ls -la
Signed-off-by: Shukui Yang <[email protected]>
1 parent 9931262 commit cc0e2d5

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

exec.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
var execCommand = cli.Command{
1919
Name: "exec",
2020
Usage: "execute new process inside the container",
21-
ArgsUsage: `<container-id> -- <container command> [command options]
21+
ArgsUsage: `<container-id> <container command> [command options]
2222
2323
Where "<container-id>" is the name for the instance of the container and
2424
"<container command>" is the command to be executed in the container.
@@ -158,9 +158,6 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
158158
}
159159
p := spec.Process
160160
p.Args = context.Args()[1:]
161-
if len(p.Args) > 1 && p.Args[0] == "--" {
162-
p.Args = p.Args[1:]
163-
}
164161
// override the cwd, if passed
165162
if context.String("cwd") != "" {
166163
p.Cwd = context.String("cwd")

tests/integration/exec.bats

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,17 @@ function teardown() {
4343
[ "$status" -eq 0 ]
4444
[[ ${lines[0]} =~ [0-9]+ ]]
4545
}
46+
47+
@test "runc exec ls -la" {
48+
# run busybox detached
49+
runc run -d --console /dev/pts/ptmx test_busybox
50+
[ "$status" -eq 0 ]
51+
52+
wait_for_container 15 1 test_busybox
53+
54+
runc exec test_busybox ls -la
55+
[ "$status" -eq 0 ]
56+
[[ ${lines[0]} == *"total"* ]]
57+
[[ ${lines[1]} == *"."* ]]
58+
[[ ${lines[2]} == *".."* ]]
59+
}

0 commit comments

Comments
 (0)