raise errors on external program failure; ensure working dir is created