{"thread":{"id":"57203","subject":"[PATCH v2] git-p4: fixed instantiation of CalledProcessError","startedAt":"2022-01-06T21:42:27Z","lastAt":"2022-01-06T21:42:27Z","messageCount":1,"participants":["Joel Holdsworth"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"445658","messageId":"20220106214156.90967-1-jholdsworth@nvidia.com","threadId":"57203","inReplyTo":null,"subject":"[PATCH v2] git-p4: fixed instantiation of CalledProcessError","fromName":"Joel Holdsworth","fromEmail":"jholdsworth@nvidia.com","sentAt":"2022-01-06T21:41:56Z","receivedAt":"2022-01-06T21:42:27Z","isPatch":true,"sender":{"key":"jholdsworth@nvidia.com","avatar":"https://avatars.githubusercontent.com/u/1449493?v=4"},"body":"CalledProcessError is an exception class from the subprocess namespace.\nWhen raising this exception, git-p4 would instantiate CalledProcessError\nobjects without properly referencing the subprocess namespace causing\nthe script to fail.\n\nThis patch resolves the issue by replacing CalledProcessError with\nsubprocess.CalledProcessError.\n\nSigned-off-by: Joel Holdsworth <jholdsworth@nvidia.com>\n---\nThis version adds a previously missing sign-off.\n\n git-p4.py | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 986595bef0..eefac27803 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -394,7 +394,7 @@ def system(cmd, ignore_error=False):\n         sys.stderr.write(\"executing %s\\n\" % str(cmd))\n     retcode = subprocess.call(cmd, shell=expand)\n     if retcode and not ignore_error:\n-        raise CalledProcessError(retcode, cmd)\n+        raise subprocess.CalledProcessError(retcode, cmd)\n \n     return retcode\n \n@@ -404,7 +404,7 @@ def p4_system(cmd):\n     expand = not isinstance(real_cmd, list)\n     retcode = subprocess.call(real_cmd, shell=expand)\n     if retcode:\n-        raise CalledProcessError(retcode, real_cmd)\n+        raise subprocess.CalledProcessError(retcode, real_cmd)\n \n def die_bad_access(s):\n     die(\"failure accessing depot: {0}\".format(s.rstrip()))\n@@ -4169,7 +4169,7 @@ def run(self, args):\n             init_cmd.append(\"--bare\")\n         retcode = subprocess.call(init_cmd)\n         if retcode:\n-            raise CalledProcessError(retcode, init_cmd)\n+            raise subprocess.CalledProcessError(retcode, init_cmd)\n \n         if not P4Sync.run(self, depotPaths):\n             return False\n-- \n2.34.1\n\n"}]}