When running shell commands, join the command string in the utility function.
This commit is contained in:
parent
cc0e90648f
commit
fbdf2e12e8
|
@ -23,8 +23,7 @@ def extract_singlefile_standard (archive, encoding, cmd, **kwargs):
|
|||
outfile = util.get_single_outfile(kwargs['outdir'], archive)
|
||||
cmdlist.extend(['-c', '-d', '--', util.shell_quote(archive), '>',
|
||||
util.shell_quote(outfile)])
|
||||
# note that for shell calls the command must be a string
|
||||
return (" ".join(cmdlist), {'shell': True})
|
||||
return (cmdlist, {'shell': True})
|
||||
|
||||
|
||||
def test_singlefile_standard (archive, encoding, cmd, **kwargs):
|
||||
|
@ -44,5 +43,4 @@ def create_singlefile_standard (archive, encoding, cmd, *args, **kwargs):
|
|||
cmdlist.extend(['-c', '--'])
|
||||
cmdlist.extend([util.shell_quote(x) for x in args])
|
||||
cmdlist.extend(['>', util.shell_quote(archive)])
|
||||
# note that for shell calls the command must be a string
|
||||
return (" ".join(cmdlist), {'shell': True})
|
||||
return (cmdlist, {'shell': True})
|
||||
|
|
|
@ -29,5 +29,4 @@ def create_bzip2 (archive, encoding, cmd, *args, **kwargs):
|
|||
cmdlist.extend(['-c', '-z', '--'])
|
||||
cmdlist.extend([util.shell_quote(x) for x in args])
|
||||
cmdlist.extend(['>', util.shell_quote(archive)])
|
||||
# note that for shell calls the command must be a string
|
||||
return (" ".join(cmdlist), {'shell': True})
|
||||
return (cmdlist, {'shell': True})
|
||||
|
|
|
@ -25,5 +25,4 @@ def create_compress (archive, encoding, cmd, *args, **kwargs):
|
|||
cmdlist.append('-c')
|
||||
cmdlist.extend([util.shell_quote(x) for x in args])
|
||||
cmdlist.extend(['>', util.shell_quote(archive)])
|
||||
# note that for shell calls the command must be a string
|
||||
return (" ".join(cmdlist), {'shell': True})
|
||||
return (cmdlist, {'shell': True})
|
||||
|
|
|
@ -25,7 +25,7 @@ def extract_cpio (archive, encoding, cmd, **kwargs):
|
|||
if kwargs['verbose']:
|
||||
cmdlist.append('-v')
|
||||
cmdlist.extend(['<', util.shell_quote(os.path.abspath(archive))])
|
||||
return (" ".join(cmdlist), {'cwd': kwargs['outdir'], 'shell': True})
|
||||
return (cmdlist, {'cwd': kwargs['outdir'], 'shell': True})
|
||||
|
||||
|
||||
def list_cpio (archive, encoding, cmd, **kwargs):
|
||||
|
@ -50,4 +50,4 @@ def create_cpio(archive, encoding, cmd, *args, **kwargs):
|
|||
cmdlist[0:0] = findcmd
|
||||
cmdlist.append('-0')
|
||||
cmdlist.extend([">", util.shell_quote(archive)])
|
||||
return (" ".join(cmdlist), {'shell': True})
|
||||
return (cmdlist, {'shell': True})
|
||||
|
|
|
@ -30,4 +30,4 @@ def extract_rpm (archive, encoding, cmd, **kwargs):
|
|||
r'"*\.\.*"']
|
||||
if kwargs['verbose']:
|
||||
cmdlist.append('-v')
|
||||
return (" ".join(cmdlist), {'cwd': kwargs['outdir'], 'shell': True})
|
||||
return (cmdlist, {'cwd': kwargs['outdir'], 'shell': True})
|
||||
|
|
|
@ -25,5 +25,4 @@ def extract_compress (archive, encoding, cmd, **kwargs):
|
|||
outfile = util.get_single_outfile(kwargs['outdir'], archive)
|
||||
cmdlist.extend(['-c', util.shell_quote(archive), '>',
|
||||
util.shell_quote(outfile)])
|
||||
# note that for shell calls the command must be a string
|
||||
return (" ".join(cmdlist), {'shell': True})
|
||||
return (cmdlist, {'shell': True})
|
||||
|
|
|
@ -95,6 +95,9 @@ def run (cmd, **kwargs):
|
|||
if kwargs:
|
||||
log_info(" with %s" % ", ".join("%s=%s" % (k, shell_quote(str(v)))\
|
||||
for k, v in kwargs.items()))
|
||||
if kwargs.get("shell"):
|
||||
# for shell calls the command must be a string
|
||||
cmd = " ".join(cmd)
|
||||
return subprocess.call(cmd, **kwargs)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue