1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

Fix _dsh being interrupted by keyboard input, closing stdin

This commit is contained in:
Joe Groocock 2017-08-27 16:40:13 +01:00
parent 001a0f23ec
commit 8a3fd3c61a
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86

View File

@ -189,7 +189,7 @@ _dsh() {
usercmd="--user=$user "
fi
if [ "$dowhat" = 'exec' -a -z "$(docker ps -q -f name="$host")" ]; then
if [ "$dowhat" = 'exec' -a -z "$(docker ps -q -f name="$host")" <&- ]; then
echo "No such container $host" >&2
return 5
fi
@ -197,7 +197,7 @@ _dsh() {
if [ -z "$prog" ]; then
set -o pipefail
for shell in bash sh; do
if shell_path="$(eval "docker $dowhat -ti $host which $shell" | sed 's|[\r\n]||g')"; then
if shell_path="$(eval "docker $dowhat $rm $host which $shell" <&- | sed 's|[\r\n]||g')"; then
prog="$shell_path"
break
fi