Skip to content

Commit 561ff8f

Browse files
committed
Add try/except clauses to catch potential decode errors on stdout and stderr
1 parent 549ea16 commit 561ff8f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gitless/core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,10 +1270,18 @@ def _stash_msg_merge(name):
12701270
'OpCb', ['apply_ok', 'apply_err', 'save', 'restore_ok'])
12711271

12721272
def stdout(p):
1273-
return p.stdout.decode(ENCODING)
1273+
try:
1274+
pstdout = p.stdout.decode(ENCODING)
1275+
except AttributeError:
1276+
pstdout = p.stdout
1277+
return pstdout
12741278

12751279
def stderr(p):
1276-
return p.stderr.decode(ENCODING)
1280+
try:
1281+
pstderr = p.stderr.decode(ENCODING)
1282+
except AttributeError:
1283+
pstderr = p.stderr
1284+
return pstderr
12771285

12781286
def walker(git_repo, target, reverse):
12791287
flags = pygit2.GIT_SORT_TOPOLOGICAL | pygit2.GIT_SORT_TIME

0 commit comments

Comments
 (0)