From f574c1d0a3d1604e46f916529226af29cd8cab43 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Sun, 11 Feb 2024 00:57:44 +0200 Subject: [PATCH 1/4] Handle DOKKU_FORCE_TTY in has_tty function --- plugins/common/functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/common/functions b/plugins/common/functions index 7359a980a..716eced85 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -4,6 +4,10 @@ set -eo pipefail has_tty() { declare desc="return 0 if we have a tty" + if [[ "$DOKKU_FORCE_TTY" == "true" ]]; then + return 0 + fi + if [[ "$DOKKU_DISABLE_TTY" == "true" ]]; then return 1 fi From 180cc6204b80f46a88c971ea7c6ddc021fda47f9 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Sun, 11 Feb 2024 01:05:01 +0200 Subject: [PATCH 2/4] Update fn-help-content to add --force-tty usage --- plugins/run/help-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/run/help-functions b/plugins/run/help-functions index ec2835771..c20ec4746 100755 --- a/plugins/run/help-functions +++ b/plugins/run/help-functions @@ -28,7 +28,7 @@ fn-help-content() { declare desc="return help content" cat < , Run a command in a new container using the current app image - run:detached [-e|-env KEY=VALUE] [--no-tty] , Run a command in a new detached container using the current app image + run:detached [-e|-env KEY=VALUE] [--no-tty|--force-tty] , Run a command in a new detached container using the current app image run:list [--format json|stdout] , List all run containers for an app run:logs [-h] [-t] [-n num] [-q], Display recent log output for run containers run:stop , Stops all run containers for an app or a specified run container From a62cb1de8f24aa6ce3274e931ee4e238cc98540f Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Sun, 11 Feb 2024 11:50:34 +0200 Subject: [PATCH 3/4] Handle --force-tty flag in fn-run --- plugins/run/internal-functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/run/internal-functions b/plugins/run/internal-functions index 28f564328..cf6f00eec 100755 --- a/plugins/run/internal-functions +++ b/plugins/run/internal-functions @@ -21,6 +21,10 @@ fn-run() { export DOKKU_DISABLE_TTY=true shift ;; + --force-tty) + export DOKKU_FORCE_TTY=true + shift + ;; --cron-id) if [[ ! $2 ]]; then dokku_log_warn "expected $1 to have an argument" From 95c049609f54655e152aac06c81865a6f13ae669 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Sun, 11 Feb 2024 13:54:10 +0200 Subject: [PATCH 4/4] Exit if both --force-tty and --no-tty are set --- plugins/run/internal-functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/run/internal-functions b/plugins/run/internal-functions index cf6f00eec..a09694c66 100755 --- a/plugins/run/internal-functions +++ b/plugins/run/internal-functions @@ -54,6 +54,10 @@ fn-run() { esac done + if [[ "$DOKKU_DISABLE_TTY" == "true" ]] && [[ "$DOKKU_FORCE_TTY" == "true" ]]; then + dokku_log_fail "Cannot specify both --force-tty and --no-tty" + fi + verify_app_name "$APP" local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")