diff --git a/hammer.py b/hammer.py index 0c2bc62f46..01170b5a11 100755 --- 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: