diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2024-01-18 19:09:58 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-01-18 19:09:58 +0100 |
commit | cc7362d28bd9c43cb6839809f86e59874f2fe458 (patch) | |
tree | 1053748f5890c769d1e99806bc0c8bcffca6f0fe /libbe/util/subproc.py | |
parent | 003bd13629d9db2f14156f97b74a4672e9ecdf77 (diff) | |
download | bugseverywhere-cc7362d28bd9c43cb6839809f86e59874f2fe458.tar.gz |
2to3 conversion of the repo.
Diffstat (limited to 'libbe/util/subproc.py')
-rw-r--r-- | libbe/util/subproc.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbe/util/subproc.py b/libbe/util/subproc.py index 0ad010c..5412b08 100644 --- a/libbe/util/subproc.py +++ b/libbe/util/subproc.py @@ -25,7 +25,7 @@ import sys import types import libbe -from encoding import get_encoding +from .encoding import get_encoding if libbe.TESTING == True: import doctest @@ -56,7 +56,7 @@ def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,), """ if cwd == None: cwd = '.' - if isinstance(shell, types.StringTypes): + if isinstance(shell, (str,)): list_args = ' '.split(args) # sloppy, but just for logging str_args = args else: @@ -76,7 +76,7 @@ def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,), # win32 don't have os.execvp() so have to run command in a shell q = Popen(args, stdin=PIPE, stdout=stdout, stderr=stderr, shell=shell, cwd=cwd, **kwargs) - except OSError, e: + except OSError as e: raise CommandError(list_args, status=e.args[0], stderr=e) stdout,stderr = q.communicate(input=stdin) status = q.wait() @@ -84,10 +84,10 @@ def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,), if encoding == None: encoding = get_encoding() if stdout != None: - stdout = unicode(stdout, encoding) + stdout = str(stdout, encoding) if stderr != None: - stderr = unicode(stderr, encoding) - libbe.LOG.debug(u'{0}\n{1}{2}'.format(status, stdout, stderr)) + stderr = str(stderr, encoding) + libbe.LOG.debug('{0}\n{1}{2}'.format(status, stdout, stderr)) else: libbe.LOG.debug('{0}\n{1}{2}'.format(status, stdout, stderr)) if status not in expect: |