From 3b271e82df2cce4fd44f109478c1a44d9540da2d Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Mon, 14 Oct 2019 21:45:23 +0300 Subject: [PATCH] Don't use /dev/stderr. In some cases (like a chroots or containers with minimal /dev) /dev/stderr is not available. Replace outputting to fd 2 instead. git grep -l '>> /dev/stderr' | xargs sed -i 's@>> /dev/stderr@>\&2@g' --- .bashrc | 2 +- .githooks/post-merge | 16 ++++++++-------- Documents/bin/_docker-remote | 2 +- Documents/bin/dt | 2 +- Documents/bin/forward | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.bashrc b/.bashrc index 332d00d..c85bb51 100644 --- a/.bashrc +++ b/.bashrc @@ -279,7 +279,7 @@ match_ssl_pair () { flatpak_kill () { if [ "$#" -lt 1 ] then - echo "You must specify application name." >> /dev/stderr + echo "You must specify application name." >&2 false else name="$1" diff --git a/.githooks/post-merge b/.githooks/post-merge index 2d875cf..4165d4e 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -2,7 +2,7 @@ set -eux eval "$(grep 'export HELM_HOME' .bashrc)" cd "$(git rev-parse --show-toplevel)" -echo Installing Golang apps >> /dev/stderr +echo Installing Golang apps >&2 go get github.com/giantswarm/semver-bump || true go get github.com/nishanths/license || true go get github.com/jmespath/jp || true @@ -10,22 +10,22 @@ go get github.com/spelufo/on-change || true go get github.com/kaorimatz/mysqldump-loader || true go get github.com/lucagrulla/cw || true go get sigs.k8s.io/kind || true -echo Installing Python apps >> /dev/stderr +echo Installing Python apps >&2 python3 -m pip install --user --requirement requirements.txt -echo Downloading binary and vendored files, creating generated files >> /dev/stderr +echo Downloading binary and vendored files, creating generated files >&2 git clean -fX .bash_completion.d/ make all -echo Installing Git hooks >> /dev/stderr +echo Installing Git hooks >&2 Documents/bin/install-git-hooks -echo Loading dconf config >> /dev/stderr +echo Loading dconf config >&2 Documents/bin/dconf-load -echo Configuring Git repo >> /dev/stderr +echo Configuring Git repo >&2 git config --local status.showUntrackedFiles no -echo Adding Cron job >> /dev/stderr +echo Adding Cron job >&2 Documents/bin/cron-jobs if command -v vagrant > /dev/null then - echo Installing Vagrant plugins >> /dev/stderr + echo Installing Vagrant plugins >&2 for plugin in landrush vagrant-gatling-rsync do vagrant plugin list | grep -qw "$plugin" || vagrant plugin install "$plugin" || true diff --git a/Documents/bin/_docker-remote b/Documents/bin/_docker-remote index 62a5421..cb0cf54 100755 --- a/Documents/bin/_docker-remote +++ b/Documents/bin/_docker-remote @@ -2,7 +2,7 @@ set -eu -[ -n "$1" ] || { echo "You must specify host." >> /dev/stderr; exit 1; } +[ -n "$1" ] || { echo "You must specify host." >&2; exit 1; } host="$1" localsocket="$HOME/.ssh/docker_$host.sock" diff --git a/Documents/bin/dt b/Documents/bin/dt index a434aec..5ea80a3 100755 --- a/Documents/bin/dt +++ b/Documents/bin/dt @@ -1,7 +1,7 @@ #!/bin/sh set -eu -[ "$#" -gt '0' ] || { echo "Output not specified." >> /dev/stderr; return 1; } +[ "$#" -gt '0' ] || { echo "Output not specified." >&2; return 1; } while [ "$#" -gt '1' ] do args="${args:-} $1" diff --git a/Documents/bin/forward b/Documents/bin/forward index 46c23f1..d648670 100755 --- a/Documents/bin/forward +++ b/Documents/bin/forward @@ -5,8 +5,8 @@ usage () { echo "Usage: $0 host forward" } -host="$1" || { usage >> /dev/stderr; exit 1; } -forward="$2" || { usage >> /dev/stderr; exit 1; } +host="$1" || { usage >&2; exit 1; } +forward="$2" || { usage >&2; exit 1; } alias ssh='ssh -fnNTS ~/.ssh/%C.sock' # shellcheck disable=SC2029 -- GitLab