commit:     32e34dbcc4b5054c42dfc3e8790dddf4c4211c96
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  9 01:46:46 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Jul  9 01:46:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=32e34dbc

grs/RunScript.py: check if the script exists before trying to unlink it.

 grs/RunScript.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/grs/RunScript.py b/grs/RunScript.py
index b49f4f1..0e5d48e 100644
--- a/grs/RunScript.py
+++ b/grs/RunScript.py
@@ -25,4 +25,7 @@ class RunScript():
         os.chmod(script_dst, 0o0755)
         cmd = 'chroot %s /tmp/script' % self.portage_configroot
         Execute(cmd, timeout=None, logfile=self.logfile)
-        os.unlink(script_dst)
+        # In the case of a clean script, it can delete itself, so
+        # check if the script exists before trying to delete it.
+        if os.path.isfile(script_dst):
+            os.unlink(script_dst)

Reply via email to