Skip to content

Commit cf190ee

Browse files
committed
improved rsync stdout and stderr report
1 parent e10b88f commit cf190ee

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bit/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
from subprocess import Popen, PIPE, STDOUT
88
import stat
9+
import shlex
910

1011
import bit.config as config
1112
import bit.git as git
@@ -15,8 +16,16 @@
1516
import multiprocessing as mp
1617

1718
def worker(call):
18-
os.system(call)
19-
return call
19+
out=Popen(shlex.split(call), stdout=PIPE, stdin=PIPE, stderr=PIPE)
20+
message=out.communicate()
21+
out.stdout.close()
22+
out.stdin.close()
23+
out.stderr.close()
24+
try:
25+
out.kill()
26+
except:
27+
pass
28+
return "\n********************\n"+call.split(" ")[-1]+"\n"+message[0]+"\n"+message[1]
2029

2130
def main():
2231

@@ -65,6 +74,7 @@ def main():
6574
results=[]
6675
for ff in funclist:
6776
res=ff.get()
77+
print(res)
6878
results.append(res)
6979

7080
if args.config:

0 commit comments

Comments
 (0)