]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2657] replace ~/ with absolute path
authorWlodek Wencel <wlodek@isc.org>
Wed, 30 Nov 2022 11:29:34 +0000 (12:29 +0100)
committerWlodek Wencel <wlodek@isc.org>
Wed, 30 Nov 2022 11:29:34 +0000 (12:29 +0100)
hammer.py

index 0c2bc62f4653985cc5ee58dd68e3650a67860efd..01170b5a11783dc1230fdd204c8071cde17a827d 100755 (executable)
--- a/hammer.py
+++ b/hammer.py
@@ -335,6 +335,9 @@ def execute(cmd, timeout=60, cwd=None, env=None, raise_error=True, dry_run=False
         quiet = True
     if not super_quiet:
         log.info('>>>>> Executing %s in %s', cmd, cwd if cwd else os.getcwd())
+    if cwd and "~/" in cwd:
+        # replace relative home directory
+        cwd = cwd.replace('~', execute('cd ~ && pwd', capture=True, super_quiet=True)[1].rstrip())
     if not check_times:
         timeout = None
     if dry_run: