On 5/13/2022 5:38 AM, Lars Ingebrigtsen wrote: > Jim Porter writes: >> I agree that this would definitely be nice to have though. > > Yup. And here's a patch series. It's a bit long, so I'll summarize the changes. The first patch just adds docs/tests for the existing code, plus a bit of code cleanup. It also fixes a very small edge case I stumbled upon, where "echo foo >a >b >a" only writes to "a". That was just a logic bug in 'eshell-set-output-handle'. The second patch enhances 'eshell-interactive-output-p' so that it can check just stdout (or stderr) for interactivity, or all. This is technically a behavior change in some functions that call this, but I looked through all of them, and I think the new behavior makes more sense. This is really just laying the groundwork for the final patch in the series though. The third patch adds all the parsing and command handling for various new kinds of redirect operators, like '&>', '2>&1', and '|&'. The fourth patch moves some internal Eshell process bookkeeping onto the process objects. That way, we can reuse this code when making a pipe process. I also added some more tests for the existing code (this time just for external process handling). The final patch fixes the actual issue described in this bug. When creating an external process, it checks whether stdout and stderr go to different places. If so, it makes a pipe process to monitor stderr and routes everything as appropriate.