Skip to content

Commit

Permalink
new execute value
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Oct 25, 2015
1 parent dd1426f commit 30c687d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/quorum/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@ def unquote(value, *args, **kwargs):
if is_bytes: value = value.decode("utf-8")
return value

def execute(args, command = None, path = None, shell = True):
def execute(args, command = None, path = None, shell = True, encoding = None):
if not encoding: encoding = sys.getfilesystemencoding()
if command: args = command.split(" ")
process = subprocess.Popen(
args,
Expand All @@ -796,11 +797,8 @@ def execute(args, command = None, path = None, shell = True):
cwd = path
)
code = process.wait()
process.stdout.seek(0)
process.stderr.seek(0)
stdout = process.stdout.read()
stderr = process.stderr.read()
encoding = sys.getfilesystemencoding()
stdout = stdout.decode(encoding)
stderr = stderr.decode(encoding)
return dict(
Expand Down

0 comments on commit 30c687d

Please sign in to comment.