From 2a80e48a92c9bc96bc6b5ddeaced450e1edb0578 Mon Sep 17 00:00:00 2001 From: Fabian Schilling Date: Fri, 10 Dec 2021 18:23:44 +0100 Subject: [PATCH] Pass working directory to execute functions --- borgmatic/borg/create.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/borgmatic/borg/create.py b/borgmatic/borg/create.py index 6b02c87dd..009ecf6e6 100644 --- a/borgmatic/borg/create.py +++ b/borgmatic/borg/create.py @@ -211,6 +211,10 @@ def create_archive( ) ) + try: + working_directory = os.path.expanduser(location_config.get('working_directory')) + except TypeError: + working_directory = None pattern_file = _write_pattern_file(location_config.get('patterns')) exclude_file = _write_pattern_file( _expand_home_directories(location_config.get('exclude_patterns')) @@ -283,6 +287,13 @@ def create_archive( output_log_level, output_file, borg_local_path=local_path, + working_directory=working_directory, ) - return execute_command(full_command, output_log_level, output_file, borg_local_path=local_path) + return execute_command( + full_command, + output_log_level, + output_file, + borg_local_path=local_path, + working_directory=working_directory, + )