rewrite popen to use posix_spawn instead of fragile vfork hacks