raise when cmd failed, ensure tempdirs are removed