cicada still has a bad issue that it stuck when the latter commands finish first. For example,
$ ps ax | head -n 3
If your system run a lot of programs, this pipeline will stuck, though you can hit CTRL+C to escape.
Note: ps ax | tail does not suck.
USER PID PPID PGID TPGID STAT COMMAND
mitnk 9471 9470 9470 9582 S -cicada
root 9582 9471 9582 9582 S+ ps ax
mitnk 9583 9471 9582 9582 Z+ (head)
If the above command didn't stuck on your side (ps has less items), you can create a file with huge lines in it, then the following command will do:
$ cat file-with-100k-lines.txt | head -n 3
Logically, when the second command finish its job, will terminate and close its resource, the output of the pipe; then the first (still running) command noticed (when trying write to) the pipe is closed, it will terminate too.
I haven't tackled it yet. Maybe a signal handle issue, maybe not.
cicada still has a bad issue that it stuck when the latter commands finish first. For example,
If your system run a lot of programs, this pipeline will stuck, though you can hit CTRL+C to escape. Note:
ps ax | tail
does not suck.If the above command didn't stuck on your side (ps has less items), you can create a file with huge lines in it, then the following command will do:
Logically, when the second command finish its job, will terminate and close its resource, the output of the pipe; then the first (still running) command noticed (when trying write to) the pipe is closed, it will terminate too.
I haven't tackled it yet. Maybe a signal handle issue, maybe not.