{"thread":{"id":"57189","subject":"[PATCH] git-p4: fixed instantiation of CalledProcessError","startedAt":"2022-01-05T14:14:46Z","lastAt":"2022-01-06T17:49:27Z","messageCount":2,"participants":["Joel Holdsworth","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"445523","messageId":"20220105141427.48861-1-jholdsworth@nvidia.com","threadId":"57189","inReplyTo":null,"subject":"[PATCH] git-p4: fixed instantiation of CalledProcessError","fromName":"Joel Holdsworth","fromEmail":"jholdsworth@nvidia.com","sentAt":"2022-01-05T14:14:27Z","receivedAt":"2022-01-05T14:14:46Z","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---\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 cb37545455..ab3822696c 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -406,7 +406,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@@ -416,7 +416,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@@ -4110,7 +4110,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"},{"id":"445634","messageId":"CAPig+cSe8i9VxhJifFui0Or22fXMbD_vgy-cdRgYcA20WkGhTg@mail.gmail.com","threadId":"57189","inReplyTo":"20220105141427.48861-1-jholdsworth@nvidia.com","subject":"Re: [PATCH] git-p4: fixed instantiation of CalledProcessError","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-01-06T17:49:10Z","receivedAt":"2022-01-06T17:49:27Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Jan 6, 2022 at 1:56 AM Joel Holdsworth <jholdsworth@nvidia.com> wrote:\n> CalledProcessError is an exception class from the subprocess namespace.\n> When raising this exception, git-p4 would instantiate CalledProcessError\n> objects without properly referencing the subprocess namespace causing\n> the script to fail.\n>\n> This patch resolves the issue by replacing CalledProcessError with\n> subprocess.CalledProcessError.\n> ---\n\nMIssing sign-off.\n"}]}