Mageia Bugzilla – Attachment 4179 Details for
Bug 952
mgarepo up doesn't handle conflicts well
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Stop doing blocking reads
no-svn-blocking.patch (text/plain), 1.24 KB, created by
Dan Fandrich
on 2013-06-30 03:01:16 CEST
(
hide
)
Description:
Stop doing blocking reads
Filename:
MIME Type:
Creator:
Dan Fandrich
Created:
2013-06-30 03:01:16 CEST
Size:
1.24 KB
patch
obsolete
>Index: MgaRepo/util.py >=================================================================== >--- MgaRepo/util.py (revision 8580) >+++ MgaRepo/util.py (working copy) >@@ -7,6 +7,7 @@ > import sys > import os > import re >+import select > from cStringIO import StringIO > import httplib2 > #import commands >@@ -35,13 +36,20 @@ > of = pipe.stdout.fileno() > ef = pipe.stderr.fileno() > while True: >- odata = os.read(of, 8192) >- sys.stdout.write(odata) >- edata = os.read(ef, 8192) >- err.write(edata) >- sys.stderr.write(edata) >+ r,w,x = select.select((of,ef), (), ()) >+ odata = None >+ if of in r: >+ odata = os.read(of, 8192) >+ sys.stdout.write(odata) >+ >+ edata = None >+ if ef in r: >+ edata = os.read(ef, 8192) >+ err.write(edata) >+ sys.stderr.write(edata) >+ > status = pipe.poll() >- if status is not None and not (odata and edata): >+ if status is not None and odata == "" and edata == "": > break > output = err.getvalue() > else:
Index: MgaRepo/util.py =================================================================== --- MgaRepo/util.py (revision 8580) +++ MgaRepo/util.py (working copy) @@ -7,6 +7,7 @@ import sys import os import re +import select from cStringIO import StringIO import httplib2 #import commands @@ -35,13 +36,20 @@ of = pipe.stdout.fileno() ef = pipe.stderr.fileno() while True: - odata = os.read(of, 8192) - sys.stdout.write(odata) - edata = os.read(ef, 8192) - err.write(edata) - sys.stderr.write(edata) + r,w,x = select.select((of,ef), (), ()) + odata = None + if of in r: + odata = os.read(of, 8192) + sys.stdout.write(odata) + + edata = None + if ef in r: + edata = os.read(ef, 8192) + err.write(edata) + sys.stderr.write(edata) + status = pipe.poll() - if status is not None and not (odata and edata): + if status is not None and odata == "" and edata == "": break output = err.getvalue() else:
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 952
:
4178
| 4179