neovim/neovim — pull request #1263 by splinterofchaos (2014-10-03 02:32:31+00:00)
Title: [WIP/RFC] Add a callback to `os_call_shell()` for reading.

This implements one of the improvements mentioned in #473; adds a callback to `os_call_shell()` and some of its callers. Unfortunately, this does not replace the `kShellOptRead` like suggested, but it opens the door for instances of `call_shell()`, `do_shell()`, and other such functions, to gain callbacks on a case-by-case basis. Only after all cases have been handled can it be replaced.

I rewired `:diffupdate` (or `:Gdiff` to fugitives) to use a callback, and `get_cmd_output()`, but I have no clue when the latter actually gets used. (I rewired `f_system()` just to test it!).

Originally, my plan was to use this as an alternate solution to #1241, but whereas with a job I could give stdin and stderr their own callbacks, I don't see much use for that here. better would be an option to squash stdin and -err into the same pipe stream, which `ex_make()` really needs to work correctly, but I couldn't figure how to make libuv do that. (According to a libuv test named [`spawn_same_stdout_stderr`](https://github.com/joyent/libuv/blob/master/test/test-spawn.c#L643), setting the `stdio_count` to 2 should be sufficient, but it didn't work.)

Obviously there is much more work to do, but I'm a fan of small, incremental changes and this PR already modifies hundreds of lines. Posting this as `WIP/RFC` because I might decide to add/change a few things in the next couple of days.