git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-p4: fixed instantiation of CalledProcessError
@ 2022-01-05 14:14 Joel Holdsworth
  2022-01-06 17:49 ` Eric Sunshine
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Holdsworth @ 2022-01-05 14:14 UTC (permalink / raw)
  To: git, Luke Diamand, Junio C Hamano
  Cc: Tzadik Vanderhoof, Dorgon Chang, Joachim Kuebart, Daniel Levin,
	Johannes Schindelin, Ben Keene, Andrew Oakley, Joel Holdsworth

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(-)

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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-p4: fixed instantiation of CalledProcessError
  2022-01-05 14:14 [PATCH] git-p4: fixed instantiation of CalledProcessError Joel Holdsworth
@ 2022-01-06 17:49 ` Eric Sunshine
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sunshine @ 2022-01-06 17:49 UTC (permalink / raw)
  To: Joel Holdsworth
  Cc: Git List, Luke Diamand, Junio C Hamano, Tzadik Vanderhoof,
	Dorgon Chang, Joachim Kuebart, Daniel Levin, Johannes Schindelin,
	Ben Keene, Andrew Oakley

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-06 17:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 14:14 [PATCH] git-p4: fixed instantiation of CalledProcessError Joel Holdsworth
2022-01-06 17:49 ` Eric Sunshine

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).