Skip to content

Commit 484e034

Browse files
author
zhenwei-li
committed
Popen 适配 Python 3.x 规范
1 parent 562f4aa commit 484e034

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/com/dvsnier/process/execute.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def execute(cmds, quiet=True):
3838
print('\r'),
3939
msg = '[%.5f] -> %s' % (end - start, ' | '.join(cmds))
4040
print(msg)
41-
content = ''
41+
content = None
4242
if sys.version_info.major > 2:
43-
content = str(output.rstrip(bytes('\n', encoding='utf-8')))
43+
content = str(output.rstrip(bytes('\n', encoding='utf-8')), encoding='utf-8')
4444
else:
4545
content = output.rstrip('\n')
4646
# logging.debug('the current run process pid(cwd: %s, ppid: %s, id: %s%d).' %

tests/com/dvsnier/process/test_execute.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding:utf-8 -*-
22

33
import unittest
4+
45
from com.dvsnier.process.execute import execute, trace
56

67

0 commit comments

Comments
 (0)