Exec refactoring

Remember to merge https://github.com/appium/appium/pull/4103 after this.
> What would be even safer would be to use spawn for big exec, because if something break 200*1024, it may also reach a point where it breaks 512*1024.

I agree. This was going to be part of my suggestion for the extension of `exec` we wrote: it should work exactly the same as `exec` but it uses `spawn` under the hood to get around this issue. We see this when building selendroid fails, for example, because it spews tremendous amounts of logging.