Last active
July 24, 2020 18:52
-
-
Save mikeslattery/9b618669b63fe9dc984d5924bbb3aaee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Workaround docker wrapper for git-bash/Msys/Cygwin quirks | |
# Copy this to ~/bin/docker or /usr/local/bin/docker | |
set -euo pipefail | |
export MSYS_NO_PATHCONV=1 | |
export MSYS2_ARG_CONV_EXCL='*' | |
os="$(uname -o)" | |
realdocker="$(which -a docker | grep -v "$(readlink -f "$0")" | head -1)" | |
if [[ "$os" == "Msys" ]] || [[ "$os" == "Cygwin" ]]; then | |
printf "%s\0" "$@" > /tmp/args.txt | |
# --tty or -t requires winpty | |
if grep -ZE '^--tty|^-[^-].*t|^-t.*' /tmp/args.txt; then | |
exec winpty /bin/bash -c "xargs -0a /tmp/args.txt '$realdocker'" | |
fi | |
fi | |
exec "$realdocker" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Isn't there a "return" missing after line 16?