better error handling around spawned processes