1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

Merge pull request #192 from derkling/acme_fix_iio-capture_release

Instrument/Acmecape: ensure iio-capture termination
This commit is contained in:
setrofim 2017-10-12 16:34:48 +01:00 committed by GitHub
commit 16d5e0b6a7

View File

@ -58,6 +58,12 @@ class AcmeCapeInstrument(Instrument):
self.add_channel('device', 'current')
self.add_channel('timestamp', 'time_ms')
def __del__(self):
if self.process and self.process.pid:
self.logger.warning('killing iio-capture process [%d]...',
self.process.pid)
self.process.kill()
def reset(self, sites=None, kinds=None, channels=None):
super(AcmeCapeInstrument, self).reset(sites, kinds, channels)
self.raw_data_file = tempfile.mkstemp('.csv')[1]
@ -98,6 +104,7 @@ class AcmeCapeInstrument(Instrument):
.format(self.process.returncode, output))
if not os.path.isfile(self.raw_data_file):
raise HostError('Output CSV not generated.')
self.process = None
def get_data(self, outfile):
if os.stat(self.raw_data_file).st_size == 0: