In v3.9.0 of the gosh interpreter there is an issue with reading from file or file substitutions in while loops. The script just hangs when attempting to read from a file or file substitution.
This did work recently. I haven't narrowed down the exact version it broke in yet. I discovered this through it breaking in my Taskfile usage.
Examples
Works: Reading from pipe
#!/usr/bin/env gosh
set -x
echo "hi pipe" | while read -r line; do
echo "$line"
done
echo "done"
Hangs: Reading from file
#!/usr/bin/env gosh
set -x
echo "hi file" > hi.txt
while read -r line; do
echo "$line"
done < hi.txt
echo "done"
results in this hanging forever
$ ./while_issue.sh
+ echo 'hi file'
+ read '-r line'
+ echo 'hi file'
hi file
+ read '-r line'
Hangs: Reading from file substitution
#!/usr/bin/env gosh
set -x
while read -r line; do
echo "$line"
done < <(echo "hi file substitution")
echo done
results in this hanging forever
$ ./while_issue.sh
+ read '-r line'
+ echo 'hi file substitution'
+ echo 'hi file substitution'
hi file substitution
+ read '-r line'
In v3.9.0 of the gosh interpreter there is an issue with reading from file or file substitutions in
whileloops. The script just hangs when attempting to read from a file or file substitution.This did work recently. I haven't narrowed down the exact version it broke in yet. I discovered this through it breaking in my Taskfile usage.
Examples
Works: Reading from pipe
Hangs: Reading from file
results in this hanging forever
Hangs: Reading from file substitution
results in this hanging forever