tests: Change handling of reading non blocked empty stream for python3
The result of reading non blocked empty stream is different between python2 and 3. The python2 sends "[Errno 11] Resource temporarily unavailable" exception. The python3 could read "None" without exception, so handle this "None" case as well. Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
6447b87400
commit
0da6d93dbf
1 changed files with 8 additions and 4 deletions
|
@ -91,6 +91,8 @@ def vm_read_stdout(vm, i):
|
||||||
ready = False
|
ready = False
|
||||||
try:
|
try:
|
||||||
out = vm['proc'].stdout.read()
|
out = vm['proc'].stdout.read()
|
||||||
|
if out == None:
|
||||||
|
return False
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
logger.debug("VM[%d] stdout.read[%s]" % (i, out))
|
logger.debug("VM[%d] stdout.read[%s]" % (i, out))
|
||||||
|
@ -192,6 +194,7 @@ def show_progress(scr):
|
||||||
first_running = True
|
first_running = True
|
||||||
try:
|
try:
|
||||||
err = vm[i]['proc'].stderr.read()
|
err = vm[i]['proc'].stderr.read()
|
||||||
|
if err != None:
|
||||||
vm[i]['err'] += err
|
vm[i]['err'] += err
|
||||||
logger.debug("VM[%d] stderr.read[%s]" % (i, err))
|
logger.debug("VM[%d] stderr.read[%s]" % (i, err))
|
||||||
except:
|
except:
|
||||||
|
@ -246,6 +249,7 @@ def show_progress(scr):
|
||||||
running = True
|
running = True
|
||||||
try:
|
try:
|
||||||
err = vm[i]['proc'].stderr.read()
|
err = vm[i]['proc'].stderr.read()
|
||||||
|
if err != None:
|
||||||
vm[i]['err'] += err
|
vm[i]['err'] += err
|
||||||
logger.debug("VM[%d] stderr.read[%s]" % (i, err))
|
logger.debug("VM[%d] stderr.read[%s]" % (i, err))
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue