mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-04-07 12:43:58 +00:00
Pass --tty to docker run when running Qemu via a container
Otherwise escape codes (arrow keys etc) do not work. This is done only when stdin is a tty. For clarity spell `--tty-` and `--interactive` out in full rather than using the short versions. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
// QemuImg is the version of qemu container
|
||||
@@ -178,7 +179,11 @@ func runQemuContainer(config QemuConfig) error {
|
||||
var args []string
|
||||
config, args = buildQemuCmdline(config)
|
||||
|
||||
dockerArgs := []string{"run", "-i", "--rm", "-v", fmt.Sprintf("%s:%s", wd, "/tmp"), "-w", "/tmp"}
|
||||
dockerArgs := []string{"run", "--interactive", "--rm", "-v", fmt.Sprintf("%s:%s", wd, "/tmp"), "-w", "/tmp"}
|
||||
|
||||
if terminal.IsTerminal(int(os.Stdin.Fd())) {
|
||||
dockerArgs = append(dockerArgs, "--tty")
|
||||
}
|
||||
|
||||
if config.KVM {
|
||||
dockerArgs = append(dockerArgs, "--device", "/dev/kvm")
|
||||
|
||||
Reference in New Issue
Block a user