diff options
author | Martin Peres <martin.peres@linux.intel.com> | 2017-06-13 10:57:00 +0300 |
---|---|---|
committer | Martin Peres <martin.peres@linux.intel.com> | 2017-10-04 17:48:28 +0300 |
commit | 4b16cfce902cb42c9c6879731f29acf82fa7db0a (patch) | |
tree | 0e85536d6758b9ce18ba21e4806555d60891e04c | |
parent | 04124823f9916ec615aa5aaf2c0b8d8ff315716a (diff) |
smartezbench: make the locking code more robust
-rw-r--r-- | python-modules/ezbench/smartezbench.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/python-modules/ezbench/smartezbench.py b/python-modules/ezbench/smartezbench.py index 0f99dab..bd1e8c2 100644 --- a/python-modules/ezbench/smartezbench.py +++ b/python-modules/ezbench/smartezbench.py @@ -316,13 +316,14 @@ class SmartEzbench: def __grab_lock(self): if self.readonly: return - self.lock_fd = open(self.smart_ezbench_lock, 'w') + try: + self.lock_fd = open(self.smart_ezbench_lock, 'w') fcntl.flock(self.lock_fd, fcntl.LOCK_EX) return True except IOError as e: self.__log(Criticality.EE, "Could not lock the report: " + str(e)) - return False + raise ValueError("Can't lock the report") def __release_lock(self): if self.readonly: |