Improve Linux spawn() implementation so it works on Android/ARM

Untested on other Linux OSes and architectures.