diff mbox series

git-p4: fixed instantiation of CalledProcessError

Message ID 20220105141427.48861-1-jholdsworth@nvidia.com (mailing list archive)
State Superseded
Headers show
Series git-p4: fixed instantiation of CalledProcessError | expand

Commit Message

Joel Holdsworth Jan. 5, 2022, 2:14 p.m. UTC
CalledProcessError is an exception class from the subprocess namespace.
When raising this exception, git-p4 would instantiate CalledProcessError
objects without properly referencing the subprocess namespace causing
the script to fail.

This patch resolves the issue by replacing CalledProcessError with
subprocess.CalledProcessError.
---
 git-p4.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Eric Sunshine Jan. 6, 2022, 5:49 p.m. UTC | #1
On Thu, Jan 6, 2022 at 1:56 AM Joel Holdsworth <jholdsworth@nvidia.com> wrote:
> CalledProcessError is an exception class from the subprocess namespace.
> When raising this exception, git-p4 would instantiate CalledProcessError
> objects without properly referencing the subprocess namespace causing
> the script to fail.
>
> This patch resolves the issue by replacing CalledProcessError with
> subprocess.CalledProcessError.
> ---

MIssing sign-off.
diff mbox series

Patch

diff --git a/git-p4.py b/git-p4.py
index cb37545455..ab3822696c 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -406,7 +406,7 @@  def system(cmd, ignore_error=False):
         sys.stderr.write("executing %s\n" % str(cmd))
     retcode = subprocess.call(cmd, shell=expand)
     if retcode and not ignore_error:
-        raise CalledProcessError(retcode, cmd)
+        raise subprocess.CalledProcessError(retcode, cmd)
 
     return retcode
 
@@ -416,7 +416,7 @@  def p4_system(cmd):
     expand = not isinstance(real_cmd, list)
     retcode = subprocess.call(real_cmd, shell=expand)
     if retcode:
-        raise CalledProcessError(retcode, real_cmd)
+        raise subprocess.CalledProcessError(retcode, real_cmd)
 
 def die_bad_access(s):
     die("failure accessing depot: {0}".format(s.rstrip()))
@@ -4110,7 +4110,7 @@  def run(self, args):
             init_cmd.append("--bare")
         retcode = subprocess.call(init_cmd)
         if retcode:
-            raise CalledProcessError(retcode, init_cmd)
+            raise subprocess.CalledProcessError(retcode, init_cmd)
 
         if not P4Sync.run(self, depotPaths):
             return False