Exec refactoring

Remember to merge https://github.com/appium/appium/pull/4103 after this.
Looks like the buffer is always set to { maxBuffer: 524288 }, so might want to just set it as a constant within the function.