Process substitutions are broken with magic syntax
See original GitHub issueProcess substitutions are broken. Since these use named pipes under the hood, most systems should support their use. Note, not all shells support this syntax, for example, dash does not.
Works
% head -n 100 /dev/urandom > somefile
% jc wc somefile
[
{
"filename": "somefile",
"lines": 100,
"words": 567,
"characters": 27151
}
]
Fails
% jc wc <(cut -c 1-10 somefile)
wc: /proc/self/fd/11: No such file or directory
[]
workaround
% wc <(cut -c 1-10 somefile) | jc --wc
[
{
"filename": "/proc/self/fd/11",
"lines": 0,
"words": 1,
"characters": 950
}
]
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Process substitutions are broken with magic syntax · Issue #153 ...
It looks like I was able to get this working by adding the close_fds=False argument to the subprocess.Popen() function. $ jc wc <(echo...
Read more >Process substitution not allowed by Python's subprocess with ...
/bin/sh: 1: Syntax error: "(" unexpected. You have a bashism. It is not valid according to POSIX, which is what /bin/sh implements.
Read more >Why “process substitution” is a late feature in Unix shells
A fun trick is using the `paste` command with process substitution to combine lines of output from different commands. ./cmd1 outputs: a b...
Read more >Chapter 23. Process Substitution
Process substitution feeds the output of a process (or processes) into the stdin of another process. Template. Command list enclosed within parentheses. >( ......
Read more >Chapter 5: Substitutions - A User's Guide to the Z-Shell
More specifically, they allow parameter expansion, command substitution and arithmetic substitution, but not any of the others: process substitution doesn't ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Before / After (works for me!)
Keep in mind you can also nest process substations, each returns a unique fd to its parent.