Skip to content

Commit c817087

Browse files
committed
fix args passed to exec syscall
1 parent b4ecc7b commit c817087

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/oadm/main.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ func main() {
2424

2525
fmt.Fprintf(os.Stderr, "DEPRECATED: The 'oadm' command is deprecated, please use '%s adm' instead.\n", baseCommand)
2626

27-
if err := syscall.Exec(path, append([]string{"adm"}, os.Args[1:]...), os.Environ()); err != nil {
27+
admCmd := ""
28+
29+
// there is no `oc adm version` command.
30+
// special-case it here.
31+
if os.Args[1] != "version" {
32+
admCmd = "adm"
33+
}
34+
35+
if err := syscall.Exec(path, append([]string{baseCommand, admCmd}, os.Args[1:]...), os.Environ()); err != nil {
2836
fmt.Fprintf(os.Stderr, "%v\n", err)
2937
os.Exit(1)
3038
}

0 commit comments

Comments
 (0)