mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
rbenv help: fix 'type: write error: Broken pipe'
Sometimes the command fails with a 'type: write error: Broken pipe'. This is because 'head -1' only reads the first line, then exits. If 'type' writes the second line after 'head -1' has already exited, then the aforementioned error is triggered. We fix this by buffering the entire output of 'type' before invoking 'head -1'.
This commit is contained in:
parent
577f04653d
commit
d38d18ec25
1 changed files with 6 additions and 1 deletions
|
@ -42,8 +42,13 @@ extract_initial_comment_block() {
|
|||
}
|
||||
|
||||
collect_documentation() {
|
||||
local all_awks
|
||||
local first_awk
|
||||
all_awks=$(type -p gawk awk)
|
||||
first_awk=$(head -1 <<<"$all_awks")
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
$(type -p gawk awk | head -1) '
|
||||
"$first_awk" '
|
||||
/^Summary:/ {
|
||||
summary = substr($0, 10)
|
||||
next
|
||||
|
|
Loading…
Reference in a new issue