From f1d55f50645dac116a69198b215b537217c104ae Mon Sep 17 00:00:00 2001 From: Takashi Ando Date: Sat, 4 May 2019 10:27:51 +0900 Subject: [PATCH] Fix OSError if mech destroy #57 --- mech/mech.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mech/mech.py b/mech/mech.py index afdcaae..6fc6bf2 100644 --- a/mech/mech.py +++ b/mech/mech.py @@ -720,7 +720,10 @@ def destroy(self, arguments): vmrun.stop(mode='hard', quiet=True) time.sleep(3) vmrun.deleteVM() - shutil.rmtree(mech_path) + if os.path.exists(mech_path): + shutil.rmtree(mech_path) + else: + logger.debug("{} was not found.".format(mech_path)) else: puts_err(colored.red("Deletion aborted")) else: