commit
15a9885d16
|
|
@ -20,16 +20,6 @@ func runK(clear bool, app *appView, args ...string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
last := len(args) - 1
|
||||
if args[last] == "sh" {
|
||||
args[last] = "bash"
|
||||
if !run(clear, app, bin, args...) {
|
||||
args[last] = "sh"
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return run(clear, app, bin, args...)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -241,5 +241,5 @@ func computeShellArgs(path, co, context string, kcfg *string) []string {
|
|||
args = append(args, "-c", co)
|
||||
}
|
||||
|
||||
return append(args, "--", "sh")
|
||||
return append(args, "--", "sh", "-c", "command -v bash >/dev/null && exec bash || exec sh")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,28 +19,28 @@ func TestComputeShellArgs(t *testing.T) {
|
|||
"c1",
|
||||
"ctx1",
|
||||
&config,
|
||||
"exec -it --context ctx1 -n fred blee --kubeconfig coolConfig -c c1 -- sh",
|
||||
"exec -it --context ctx1 -n fred blee --kubeconfig coolConfig -c c1 -- sh -c command -v bash >/dev/null && exec bash || exec sh",
|
||||
},
|
||||
"noconfig": {
|
||||
"fred/blee",
|
||||
"c1",
|
||||
"ctx1",
|
||||
nil,
|
||||
"exec -it --context ctx1 -n fred blee -c c1 -- sh",
|
||||
"exec -it --context ctx1 -n fred blee -c c1 -- sh -c command -v bash >/dev/null && exec bash || exec sh",
|
||||
},
|
||||
"emptyConfig": {
|
||||
"fred/blee",
|
||||
"c1",
|
||||
"ctx1",
|
||||
&empty,
|
||||
"exec -it --context ctx1 -n fred blee -c c1 -- sh",
|
||||
"exec -it --context ctx1 -n fred blee -c c1 -- sh -c command -v bash >/dev/null && exec bash || exec sh",
|
||||
},
|
||||
"singleContainer": {
|
||||
"fred/blee",
|
||||
"",
|
||||
"ctx1",
|
||||
&empty,
|
||||
"exec -it --context ctx1 -n fred blee -- sh",
|
||||
"exec -it --context ctx1 -n fred blee -- sh -c command -v bash >/dev/null && exec bash || exec sh",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue