Open apjanke opened 9 years ago
I just digged a little deeper and figured out something.
error: xx died of signal 13
is added by git itself.
Each time we type git summary
, git will run git-summary
as a sub command. After git-summary
crashed by SIGPIPE, this error message will be printed.
To get rid of emitting error, one way is replacing git
to git-
. For example:
~/github/git-extras(master ✗) git-summary | head -4
project : git-extras
repo age : 5 年前
active : 373 days
How can we work around git's error report mechanism? I am still thinking about it.
Let's talk about other questions.
To clean up terminal settings, we can use trap clean_function EXIT
to recover tty once the script exits.
To turn off the colorization, I found a good code snippet from stackexchange
#!/usr/bin/env bash
if [ -t 1 ]
then
echo 'To tty'
else
echo 'To pipeline'
fi
I plan to send a pr to fix them.
If you do a
git-effort
orgit-summary
and pipe it to head, the programs complain about dying and maybe trigger other errors.Also, it seems like it leaves the cursor invisible when that happens.
I think they should play well with
head
/tail
/other stream filters: not emitting errors, cleaning up terminal settings, and maybe turning off the colorization when they're going to a stream and not a tty, so you can get clean plain text output if you want to.