Skip to content

Commit

Permalink
cmd/run: Don't break GNU Readline's ctrl-p shortcut
Browse files Browse the repository at this point in the history
Podman sets 'ctrl-p ctrl-q' as the default key sequence for detaching
a container. This breaks the ctrl-p shortcut that's equivalent to the
up arrow key in GNU Readline environments like Bash and Emacs.
Moreoever, toolbox containers aren't meant to be detached in the first
place.

Since Podman 1.8.1, it is now possible to unset the key sequence for
detaching [2, 3].

[0] https://tiswww.cwru.edu/php/chet/readline/readline.html#SEC15

[1] https://www.gnu.org/software/emacs/tour/

[2] Podman commit 7c623bd41ff3d534
    containers/podman#4208

[3] Podman commit ebfd253fc658ffc9
    containers/podman#5166

#394
  • Loading branch information
EnigmaCurry authored and debarshiray committed Sep 2, 2020
1 parent 9840ca5 commit 0c08a42
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,31 @@ func runCommand(container string,
}
}

logrus.Debug("Checking if 'podman exec' supports disabling the detach keys")

var detachKeys []string

if podman.CheckVersion("1.8.1") {
logrus.Debug("'podman exec' supports disabling the detach keys")
detachKeys = []string{"--detach-keys", ""}
}

envOptions := utils.GetEnvOptionsForPreservedVariables()
logLevelString := podman.LogLevel.String()

execArgs := []string{
"--log-level", logLevelString,
"exec",
}

execArgs = append(execArgs, detachKeys...)

execArgs = append(execArgs, []string{
"--interactive",
"--tty",
"--user", currentUser.Username,
"--workdir", workingDirectory,
}
}...)

execArgs = append(execArgs, envOptions...)

Expand Down

0 comments on commit 0c08a42

Please sign in to comment.