From 6400bb3885eb5b4019593e5e14f34ec00ef51a5f Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 20 Sep 2026 09:00:13 +0200 Subject: [PATCH] kodev: improve `docker` command (#16090) Add `exec` subcommand to allow executing arbitrary commands. --- kodev | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/kodev b/kodev index c2f1f7ea3..6dc97052f 100755 --- a/kodev +++ b/kodev @@ -805,7 +805,7 @@ function docker_entrypoint() { } function docker_exec() { - if ! is_kodev_command "$1"; then + if [[ "$1" != 'exec' ]] && ! is_kodev_command "$1"; then CONTAINER_ID="$1" shift fi @@ -820,7 +820,17 @@ function docker_exec() { else uid="$(id -u)" gid="$(id -g)" fi - run docker exec --interactive --tty --user="${uid}:${gid}" "${CONTAINER_ID}" ./kodev "$@" + if [[ "$1" != 'exec' ]]; then + set -- ./kodev "$@" + else + shift + fi + local cmd=(docker exec) + if [[ -z "${CI}" ]]; then + cmd+=(--interactive --tty) + fi + cmd+=(--user="${uid}:${gid}" "${CONTAINER_ID}") + run "${cmd[@]}" "$@" } function kodev-docker() { @@ -836,6 +846,8 @@ COMMANDS: destroy [CONTAINER_ID] destroy docker container [CONTAINER_ID] … run kodev command in docker container + + [CONTAINER_ID] exec … run arbitrary command in docker container " # Stop getopt parsing at the first non-option argument. export POSIXLY_CORRECT=1