Skip to content

Commit

Permalink
adjust checkprint method to the new check_shell interface
Browse files Browse the repository at this point in the history
  • Loading branch information
stolarczyk committed Mar 19, 2019
1 parent 1dd5b67 commit d9662a5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pypiper/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def run(self, cmd, target=None, lock_name=None, shell=None,
:param str | Sequence[str] target: Output file(s) to produce, optional
:param str lock_name: Name of lock file. Optional.
:param bool shell: If command requires should be run in its own shell.
Optional. Default: "guess" --will try to determine whether the
Optional. Default: None --will try to determine whether the
command requires a shell.
:param bool nofail: Whether the pipeline proceed past a nonzero return from
a process, default False; nofail can be used to implement
Expand Down Expand Up @@ -748,7 +748,7 @@ def call_follow():

return process_return_code

def checkprint(self, cmd, shell="guess", nofail=False, errmsg=None):
def checkprint(self, cmd, shell=None, nofail=False, errmsg=None):
"""
Just like callprint, but checks output -- so you can get a variable
in python corresponding to the return value of the command you call.
Expand All @@ -767,17 +767,15 @@ def checkprint(self, cmd, shell="guess", nofail=False, errmsg=None):

self._report_command(cmd)

likely_shell = check_shell(cmd)
likely_shell = check_shell(cmd, shell)

if shell == "guess":
if shell is None:
shell = likely_shell

if not shell:
if likely_shell:
print("Should this command run in a shell instead of directly in a subprocess?")
#cmd = cmd.split()
cmd = shlex.split(cmd)
# else: # if shell: # do nothing (cmd is not split)

try:
return subprocess.check_output(cmd, shell=shell)
Expand All @@ -801,6 +799,8 @@ def callprint(self, cmd, shell, lock_file=None, nofail=False, container=None):
:param bool nofail: Should the pipeline bail on a nonzero return from a process? Default: False
Nofail can be used to implement non-essential parts of the pipeline; if these processes fail,
they will not cause the pipeline to bail out.
:param bool shell: if the command should be run it its own shell, default: None (will try
to determine based on the command)
:param container: Named Docker container in which to execute.
:param container: str
"""
Expand Down

0 comments on commit d9662a5

Please sign in to comment.