]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jh/p4-spawning-external-commands-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Sat, 5 Feb 2022 17:42:29 +0000 (09:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 5 Feb 2022 17:42:30 +0000 (09:42 -0800)
* jh/p4-spawning-external-commands-cleanup:
  git-p4: don't print shell commands as python lists
  git-p4: pass command arguments as lists instead of using shell
  git-p4: don't select shell mode using the type of the command argument

1  2 
git-p4.py

diff --cc git-p4.py
index ab3822696c948286a518d2f348004ed75512d74e,465ed16b25b7b3302df3688fdc57e5ff3400f6c0..47ad2d6409356ca49c4965fc1be0bdf4c46e56c7
+++ b/git-p4.py
@@@ -400,23 -383,22 +395,22 @@@ def p4_has_move_command()
      # assume it failed because @... was invalid changelist
      return True
  
- def system(cmd, ignore_error=False):
-     expand = not isinstance(cmd, list)
+ def system(cmd, ignore_error=False, *k, **kw):
      if verbose:
-         sys.stderr.write("executing %s\n" % str(cmd))
-     retcode = subprocess.call(cmd, shell=expand)
+         sys.stderr.write("executing {}\n".format(
+             ' '.join(cmd) if isinstance(cmd, list) else cmd))
+     retcode = subprocess.call(cmd, *k, **kw)
      if retcode and not ignore_error:
 -        raise CalledProcessError(retcode, cmd)
 +        raise subprocess.CalledProcessError(retcode, cmd)
  
      return retcode
  
- def p4_system(cmd):
+ def p4_system(cmd, *k, **kw):
      """Specifically invoke p4 as the system command. """
      real_cmd = p4_build_cmd(cmd)
-     expand = not isinstance(real_cmd, list)
-     retcode = subprocess.call(real_cmd, shell=expand)
+     retcode = subprocess.call(real_cmd, *k, **kw)
      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()))