mirror of https://gerrit.osmocom.org/osmo-dev
sysmobts-calib attempt at nonblocking shell output
Change-Id: I94dca825203920804367d66cda13e49c2927faab
This commit is contained in:
parent
58785ddb26
commit
d33bbf770f
|
@ -17,6 +17,8 @@ import subprocess
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import argparse
|
import argparse
|
||||||
|
import select
|
||||||
|
import time
|
||||||
|
|
||||||
calib_val_re = re.compile(r'clock-calibration +([0-9]+)')
|
calib_val_re = re.compile(r'clock-calibration +([0-9]+)')
|
||||||
result_re = re.compile('The calibration value is: ([0-9]*)')
|
result_re = re.compile('The calibration value is: ([0-9]*)')
|
||||||
|
@ -48,6 +50,26 @@ def call_output(*cmd):
|
||||||
o,e = p.communicate()
|
o,e = p.communicate()
|
||||||
return o.decode('utf-8')
|
return o.decode('utf-8')
|
||||||
|
|
||||||
|
# # read the command and echo nonblocking
|
||||||
|
# p_select = select.poll()
|
||||||
|
# p_select.register(p.stdout, select.POLLIN)
|
||||||
|
#
|
||||||
|
# o = []
|
||||||
|
#
|
||||||
|
# while True:
|
||||||
|
# if p_select.poll(1):
|
||||||
|
# if p.stdout.readable:
|
||||||
|
# output = p.stdout.readline().decode('utf-8')
|
||||||
|
# o.append(output)
|
||||||
|
# sys.stdout.write(output)
|
||||||
|
# sys.stdout.flush()
|
||||||
|
# else:
|
||||||
|
# time.sleep(.25)
|
||||||
|
# if p.poll() is not None:
|
||||||
|
# break
|
||||||
|
#
|
||||||
|
# return ''.join(o)
|
||||||
|
|
||||||
def call(*cmd):
|
def call(*cmd):
|
||||||
o = call_output(*cmd)
|
o = call_output(*cmd)
|
||||||
if o:
|
if o:
|
||||||
|
|
Loading…
Reference in New Issue