diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-07-14 15:39:12 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-07-14 15:39:12 -0230 |
commit | 780df6acece64ec9e29ec42bca0242afc0b5d793 (patch) | |
tree | 07043fe31f20de8047e4e2f40b18ca8219573c24 /scripts/Expect.py | |
parent | ICE-5462 library demo doesn't validate input data (diff) | |
download | ice-780df6acece64ec9e29ec42bca0242afc0b5d793.tar.bz2 ice-780df6acece64ec9e29ec42bca0242afc0b5d793.tar.xz ice-780df6acece64ec9e29ec42bca0242afc0b5d793.zip |
Ice-5123 Improve TestUtil.py watch dog thread
Diffstat (limited to 'scripts/Expect.py')
-rwxr-xr-x | scripts/Expect.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/Expect.py b/scripts/Expect.py index f3f17cf8a33..5d231ad3e9f 100755 --- a/scripts/Expect.py +++ b/scripts/Expect.py @@ -95,8 +95,12 @@ class reader(threading.Thread): self._tbuf = getStringIO() self._tracesuppress = None self.logfile = logfile + self.watchDog = None threading.Thread.__init__(self) + def setWatchDog(self, watchDog): + self.watchDog = watchDog + def run(self): try: while True: @@ -111,6 +115,8 @@ class reader(threading.Thread): if type(c) != str: c = c.decode() self.trace(c) + if self.watchDog is not None: + self.watchDog.reset() self.buf.write(c) self.cv.notify() finally: @@ -363,7 +369,9 @@ class Expect (object): if startReader: self.startReader() - def startReader(self): + def startReader(self, watchDog = None): + if watchDog is not None: + self.r.setWatchDog(watchDog) self.r.start() def __del__(self): |