Use POSIX::Spawn instead of popen3

Popen3 doesn't seem to be timing out properly because of GVL issues. Use `POSIX::Spawn` instead, which also makes command invocations quicker.

Unfortunately there is no equivalent for `popen3` with block syntax in `POSIX::Spawn` so I had to roll this manually. I'm not sure this is ideal, maybe @tmm1 can chime in?

/cc @tnm @raganwald