STDOUT.tty? breaks pipes
Opened this issue · 2 comments
jimmycuadra commented
While writing a function to add Hitch info to my bash prompt, I was piping the output of hitch
to cut
, and wasn't getting any output. At first I thought I was doing something wrong in bash, but ultimately I discovered that Hitch.print_info
is explicitly checking if STDOUT
is a terminal and not outputting anything in that case. This prevents UNIX pipes from passing along the output of the command. Is there a reason this check is being made? Can it just be removed?
therubymug commented
At one point in time we had a hitch --info or --short that was used for this specific reason. It must have been lost in the major refactor I did a while back. I'll look into adding that back in for this.
dbi commented
I use this bash function in my prompt
function hitch_pair {
source ~/.hitch_export_authors
if [ `git symbolic-ref HEAD 2> /dev/null` ] && [ -n "${GIT_AUTHOR_EMAIL:+1}" ]; then
echo $GIT_AUTHOR_EMAIL|awk -F "[+@]" '{ print " "$2"+"$3 }'
fi
}