diff --git a/LCU/PPSTune/ppstune.py b/LCU/PPSTune/ppstune.py index a2cf22eb4f28d709a07384cca8a7db2abfc03c8c..58c3c7506efb3ac7e852fe0b6bb960f469a6dd8f 100755 --- a/LCU/PPSTune/ppstune.py +++ b/LCU/PPSTune/ppstune.py @@ -188,32 +188,32 @@ def check_output(args, stderr = None, execute = True, timeout_s = None): stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = stderr) - stdout = [] - out = '' - while True: - out = process.stdout.read(1) - if out == '' and process.poll() != None: - break - if out != '': - stdout.append(out) + + proc_ready = True + while process.poll() == None: # while poll() returns None, process is still running. if time.time() - start_date > timeout_s: + proc_ready = False logging.error('timeout after %6.3f s: terminating command %s ', timeout_s, ' '.join(args)) - os.kill(process.pid, signal.SIGTERM) - raise RuntimeError('%s killed with signal %d; output:\n%r' % - (' '.join(args), signal.SIGTERM, - ''.join(stdout))) + break + time.sleep(1.0) + logging.debug('process.poll(): %r', process.poll()) if process.poll() < 0: raise RuntimeError('%s killed with signal %d' % (' '.join(args), process.poll())) - return ''.join(stdout) + + if proc_ready: + return process.communicate()[0] + + os.kill(process.pid, signal.SIGTERM) + raise RuntimeError('%s killed with signal %d; output:\n%r' % + (' '.join(args), signal.SIGTERM, + ''.join(stdout))) + return '' else: return '' - - - def gmtime_tuple(date_s): r''' Return the ``date_s`` as a gmtime tuple containing (year, month, diff --git a/MAC/APL/PIC/RSP_Driver/src/Sequencer.cc b/MAC/APL/PIC/RSP_Driver/src/Sequencer.cc index 97ab6f666236ac1f0bb47b7741b53aa41d5c20c9..58a8880bca20b4bdf8437a951c71364298a62714 100644 --- a/MAC/APL/PIC/RSP_Driver/src/Sequencer.cc +++ b/MAC/APL/PIC/RSP_Driver/src/Sequencer.cc @@ -38,7 +38,7 @@ namespace LOFAR { namespace RSP { #define STARTUP_WAIT 10 -#define CLOCK_WAIT 4 +#define CLOCK_WAIT 5 #define TDWRITE_WAIT 1 #define TDREAD_TIMEOUT 3 #define RSUCLEAR_WAIT 5