From e28661c7e295b22d81696a3aa796d8d5d9c172fe Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Tue, 21 Sep 2021 05:05:29 +0300 Subject: [PATCH] Fix random "broken pipe" --- libexec/pyenv-help | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libexec/pyenv-help b/libexec/pyenv-help index 91962576..d89c0ffb 100755 --- a/libexec/pyenv-help +++ b/libexec/pyenv-help @@ -44,8 +44,9 @@ extract_initial_comment_block() { } collect_documentation() { - # shellcheck disable=SC2016 - $(type -P gawk awk | head -1) ' + # `tail` prevents "broken pipe" errors due to `head` closing thge pipe without reading everything + # https://superuser.com/questions/554855/how-can-i-fix-a-broken-pipe-error/642932#642932 + $(type -P gawk awk | tail -n +1 | head -1) ' /^Summary:/ { summary = substr($0, 10) next