Skip to content

Commit

Permalink
cmd/run: Unset detach keys when executing commands
Browse files Browse the repository at this point in the history
Podman sets keys 'ctrl-p' and 'ctrl-q' as the default detach keys. This
behaviour is not desirable in Toolbox. Since Podman v1.8.2[0] it is
possible to have set no detach keys by passing an empty string to the
--detach-keys option.

Thanks to this the 'Ctrl+p' and 'Ctrl-q' combinations are doing what
they should do normally in a terminal.

[0] containers/podman#5203

Fixes: containers#394

containers#396
  • Loading branch information
EnigmaCurry authored and HarryMichal committed Jul 28, 2020
1 parent 238a678 commit b078d7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ func runCommand(container string,
"--workdir", workingDirectory,
}

// Podman sets keys 'ctrl-p' and 'ctrl-q' as the default detach keys. This behaviour is not desirable in
// Toolbox. Since Podman v1.8.2 it is possible to have set no detach keys by passing an empty string to the
// --detach-keys option. https://github.com/containers/podman/pull/5203
if podman.CheckVersion("1.8.2") {
execArgs = append(execArgs, []string{"--detach-keys", ""}...)
}

execArgs = append(execArgs, envOptions...)

execArgs = append(execArgs, []string{
Expand Down
1 change: 1 addition & 0 deletions toolbox
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,7 @@ run()
--tty \
--user "$USER" \
--workdir "$PWD" \
--detach-keys="" \
$set_environment \
"$toolbox_container" \
capsh --caps="" -- -c 'exec "$@"' /bin/sh "$program" "$@" 2>&3
Expand Down

0 comments on commit b078d7d

Please sign in to comment.