Pass through the exit code properly

Also changed to `mktemp -t` that osx groks. OK on linux too?