Yes, after grokking `get_cmd_output` and `make_filter_cmd` all I could think was: what a mess.

I think `system()` can't benefit from async (at least not without explicit callback support in VimL, thus possibly adding a `system_async()` call as we can't change `system()`). For filtering `!range` it could be nice to provide continuous updates for very long running commands though. That should probably be another function: `os_run_async()`, which would conform more to @tarruda's suggested interface. The optimal case for filtering huge files is actually async both ways:

Note that in my opinion, when on requires async, one can't inherit the neovim FD's, so that will hopefully allows us to separate some concerns and hide the complexity of the implementation, providing more code reuse.