Search code examples
fish

`ls > fifo &` blocks fish shell


In fish shell, this blocks the input:

$ mkfifo fifo
$ ls > fifo &

However this works in zsh and bash.

So how can I start this kind of background process which stdout is redirected to a fifo?


Solution

  • As written, this will probably never work in fish shell. fish always opens redirections before fork, which will deadlock in this case, as the fifo has no reader.

    I think the best workaround is to make someone else open the file, for example tee:

     > mkfifo fifo
     > ls | tee fifo >/dev/null &