locks: fix bug when creating lockfiles in the current directory.
- Fixes a bug in `llnl.util.lock` - Locks in the current directory would fail because the parent directory was the empty string. - Fix this and return '.' for the parent of locks in the current directory.
This commit is contained in:
@@ -150,6 +150,11 @@ def _lock(self, op, timeout=_default_timeout):
|
||||
|
||||
def _ensure_parent_directory(self):
|
||||
parent = os.path.dirname(self.path)
|
||||
|
||||
# relative paths to lockfiles in the current directory have no parent
|
||||
if not parent:
|
||||
return '.'
|
||||
|
||||
try:
|
||||
os.makedirs(parent)
|
||||
except OSError as e:
|
||||
|
Reference in New Issue
Block a user