You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/03/23 03:25:51 UTC

[airflow] 04/34: Restore correct terminal with to interactive breeze usage (#14579)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 6b3742a2be54cbb7a099511f7b07d50a939984f6
Author: Ash Berlin-Taylor <as...@firemirror.com>
AuthorDate: Thu Mar 4 14:59:20 2021 +0000

    Restore correct terminal with to interactive breeze usage (#14579)
    
    The change to redirect all breeze output to a file had the effect of
    making stdin no longer a TTY, which meant that the docker container had
    a fixed with of 80 columns.
    
    The fix is to replace the use of `tee` with `scripts`, which does what
    we want -- captures stdout+stderr, but makes the running program believe
    that it is still attached to a terminal (if it ever was).
    
    (cherry picked from commit 4c1e3c8a16dad129d2a20fa46087f167464759eb)
---
 breeze                                              | 9 +++++----
 scripts/ci/pre_commit/pre_commit_breeze_cmd_line.sh | 2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/breeze b/breeze
index 40e3143..541c61c 100755
--- a/breeze
+++ b/breeze
@@ -24,10 +24,11 @@ AIRFLOW_SOURCES="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 if [[ ${BREEZE_REDIRECT=} == "" ]]; then
     mkdir -p "${AIRFLOW_SOURCES}"/logs
     export BREEZE_REDIRECT="true"
-    set +u
-    "${0}" "${@}" 2>&1 | tee "${AIRFLOW_SOURCES}"/logs/breeze.out
-    set -u
-    exit
+    if [[ "$(uname)" == "Darwin" ]]; then
+      exec script -q "${AIRFLOW_SOURCES}"/logs/breeze.out "$BASH" -c "$(printf "%q " "${0}" "${@}")"
+    else
+      exec script --return --quiet --log-out "${AIRFLOW_SOURCES}"/logs/breeze.out -c "$(printf "%q " "${0}" "${@}")"
+    fi
 fi
 
 export AIRFLOW_SOURCES
diff --git a/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.sh b/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.sh
index 1f20967..7a92900 100755
--- a/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.sh
+++ b/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.sh
@@ -49,6 +49,8 @@ readonly FORCE_SCREEN_WIDTH
 export VERBOSE="false"
 readonly VERBOSE
 
+export BREEZE_REDIRECT="false"
+
 ./breeze help-all | sed 's/^/  /' | sed 's/ *$//' >>"${TMP_FILE}"
 
 MAX_LEN_FOUND=$(awk '{ print length($0); }' "${TMP_FILE}" | sort -n | tail -1 )