I have a very simple test flow, where I'm executing 2 ls
commands in parallel using the split and exec node (in exec mode). One of the commands will fail because of a bad flag, the other will succeed. The successful command will write the output to stdout, and nothing to stderr. The failed command will write ""
to stdout and the error message to stderr.
I need to be able to detect when the command fails and when it succeeds but it is tricky because I have to listen on both outputs of exec node and depending on success/fail, there is either 1 message or 2. I'm using a join node to combine the stdout/sterr err outputs of exec into a single message. But what you'll see in this test flow is that my join node produces output that has combined the stderr from my successful command and the stdout from my failed command.
[{"id":"6cfa5596.55c41c","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"42748802.2f6e28","type":"inject","z":"6cfa5596.55c41c","name":"","topic":"","payload":"[\"\",\"-z\"]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":260,"wires":[["d111936d.1aaf5"]]},{"id":"d111936d.1aaf5","type":"split","z":"6cfa5596.55c41c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":350,"y":260,"wires":[["4295c7b7.cbdd98"]]},{"id":"4295c7b7.cbdd98","type":"exec","z":"6cfa5596.55c41c","command":"ls","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":510,"y":260,"wires":[["dc4a661f.0783d8"],["3fa26db7.60f9e2"],[]]},{"id":"dc4a661f.0783d8","type":"change","z":"6cfa5596.55c41c","name":"StdOut","rules":[{"t":"set","p":"topic","pt":"msg","to":"stdout","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":220,"wires":[["77bcd05a.03735","26b16e37.68abb2"]]},{"id":"3fa26db7.60f9e2","type":"change","z":"6cfa5596.55c41c","name":"StdErr","rules":[{"t":"set","p":"topic","pt":"msg","to":"stderr","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":280,"wires":[["77bcd05a.03735","ba72c385.9fc1"]]},{"id":"77bcd05a.03735","type":"join","z":"6cfa5596.55c41c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"1","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":930,"y":260,"wires":[["df8fb54f.353128"]]},{"id":"df8fb54f.353128","type":"debug","z":"6cfa5596.55c41c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1160,"y":380,"wires":[]},{"id":"ba72c385.9fc1","type":"debug","z":"6cfa5596.55c41c","name":"D-StdErr","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":860,"y":360,"wires":[]},{"id":"26b16e37.68abb2","type":"debug","z":"6cfa5596.55c41c","name":"D-StdOut","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":880,"y":160,"wires":[]}]
Is there something I'm doing wrong in how I'm executing these commands in parallel? I figured that the split node would clone the messages so that the parallel executions would not override each other's data.