Seems like basic-cli does not handle SIGPIPE well. I'm not sure if this is one issue or two. Is compiler diagnostic redundant because it doesn't happen on the executable? And should broken pipe error be propagated to the caller?
Example worth thousands of words:
How to reproduce it
test.roc
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.21.0/4rAQg8kUYZ3Vksr4qMQHpaFYNiHSn9GgS7gVxghd1XYV.tar.zst",
}
import cli.Stdout
main! = |_args| write_lines!(100000)
write_lines! = |remaining| {
if remaining == 0 {
Ok({})
} else {
Stdout.line!("line")?
write_lines!(remaining - 1)
}
}
Run:
set -o pipefail
roc test.roc | head -n 1
echo $?
Get this result:
line
The program was killed by signal 13: Unknown signal.
This is likely a bug in the Roc compiler.
...
141
Note that executable (not roc run) works and returns 141 without any errors:
roc build test.roc
set -o pipefail
./test | head -n 1
echo $?
Seems like
basic-clidoes not handle SIGPIPE well. I'm not sure if this is one issue or two. Is compiler diagnostic redundant because it doesn't happen on the executable? And should broken pipe error be propagated to the caller?Example worth thousands of words:
How to reproduce it
test.roc
Run:
Get this result:
Note that executable (not
roc run) works and returns 141 without any errors: