Skip to content

Commit

Permalink
Handle stdout and stderr better in the DEFAULT_CMD_FN
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkerz committed Oct 17, 2019
1 parent 395eb8c commit 027eb7d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pie.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Enables a user to execute predefined tasks that may accept parameters and options from the command line without any other required packages.
Great for bootstrapping a development environment, and then interacting with it.
"""
__VERSION__='0.3.0e'
__VERSION__='0.3.0f'


import inspect
Expand Down Expand Up @@ -220,12 +220,10 @@ def DEFAULT_CMD_FN(cls,c):
if cls.print_cmd:
print(c)
if not cls.dry_run:
return subprocess.call(c,shell=True)
p=subprocess.Popen(c,shell=True,stdout=sys.stdout,stderr=sys.stderr,universal_newlines=True)
p.wait()
return p.returncode
return 0
# p=subprocess.Popen(c,shell=True,stdout=sys.stdout,stderr=sys.stderr)
# # TODO: is this useful? ,universal_newlines=True
# p.wait()
# return p.returncode

# function to execute a command - can be overridden, must return an error code on failure
cmd_fn=DEFAULT_CMD_FN
Expand Down

0 comments on commit 027eb7d

Please sign in to comment.