ion -c is strange with pipes
Created by: bb010g
With an executable crash.ion
consisting of
#!/usr/bin/env ion
ion -c "cat | cat" | cat
You can get two crashes showing up. The first is reproducible with just ion -c "echo hi | cat" | cat
, which runs like so:
nixovo% ./crash.ion
thread '<unnamed>' panicked at 'begin <= end (1 <= 0) when slicing `|`', /checkout/src/libcore/str/mod.rs:2137:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
hi
zsh: abort (core dumped) ./crash.ion
The second happens with -c "cat | cat"
after you type a character:
nixovo% ./crash.ion
thread '<unnamed>' panicked at 'begin <= end (1 <= 0) when slicing `|`', /checkout/src/libcore/str/mod.rs:2137:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
zsh: abort (core dumped) ./crash.ion
nixovo% [key pressed] ion: bg [0] 17391
ion: ([0] 17392) Stopped
Pressing enter fixes the prompt. If you run this from inside ion
:
nixovo% ion
bb010g:/home/bb010g# ./crash.ion
thread '<unnamed>' panicked at 'begin <= end (1 <= 0) when slicing `|`', /checkout/src/libcore/str/mod.rs:2137:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
ion: process ended by signal
bb010g:/home/bb010g# [key pressed] ion: bg [0] 17419
ion: ([0] 17420) Stopped
bb010g:/home/bb010g# [q pressed]qzsh: suspended (tty input) ion
%
nixovo% jobs
[1] + suspended (tty input) ion
At this point you have to kill -9
the remaining ion
process.