This [library](https://github.com/Free-Software-for-Android/RootCommands) is used in [Orbot](https://gitweb.torproject.org/orbot.git) and it seems to [handle some Android inconsistencies](https://github.com/Free-Software-for-Android/RootCommands/blob/master/libraries/RootCommands/src/main/java/org/sufficientlysecure/rootcommands/Shell.java#L55) in that world. Perhaps we should use it or port some of the logic when issuing shell commands.