cicada icon indicating copy to clipboard operation
cicada copied to clipboard

Support accessing subprocess stdin/out as file

Open pothos opened this issue 3 years ago • 3 comments

Bash supports getting the FD of an opened pipe directly in the form /dev/fd/X which then can be used as file path by the spawned process.

Expected:

$ head <(echo a) <(echo b)
==> /dev/fd/63 <==
a

==> /dev/fd/62 <==
b

Got:

$ head <(echo a) <(echo b)
head: <echo: No such file or directory
head: a: No such file or directory
head: <echo: No such file or directory
head: b: No such file or directory

Same for >(CMD) which will use stdin instead of stdout.

pothos avatar Jun 07 '22 22:06 pothos

Thanks @pothos. I never use this feature in my limited use of Bash. I checked a bit and found it only useful in some cases, and it's not part of POSIX. So I'm not find the necessary of adding it to cicada.

Do you feel you depend on this feature very much when you're using a shell?

mitnk avatar Jun 12 '22 08:06 mitnk

Since bash is the de-facto standard for a shell, I simply expected it to work ;) I use it from time to time as its quite useful for things like diff <(cmd1) <(cmd2) but mostly when I'm testing single parts of a script. Fyi, it's also supported by https://github.com/nuta/nsh

pothos avatar Jun 12 '22 11:06 pothos

Let's put this to to-do-list then. I just know nsh, which I saw it support input colors, which I always want to have in cicada haha!

mitnk avatar Jun 12 '22 12:06 mitnk