Process substitution - Node.js child_process

bash, child-process, node.js, pipe, process-substitution

Solution

I solved this by putting the commands in a shell script and calling the script from the node child process. I also needed to add the following to set bash in posix mode to allow process substitution:

set +o posix

There is probably a nicer way of doing this directly from within node but it did the job. Cheers!

Problem

I'm trying to run a child process to modify a file (in two steps) before reading the modified content from stdout. I'm trying to do this by using process substitution which works perfectly in bash but not when i try it from node. This is kind of, what the command looks like.. ``` var p = exec('command2 <(capture /dev/stdout | command1 -i file -) -', function (error, stdout, stderr) { console.log(stderr); }); ``` stderr prints: ``` /bin/sh: -c: line 0: syntax error near unexpected token `(' ``` What is the proper way of doing this in node?

Original source