diff --git a/borgmatic/borg/list.py b/borgmatic/borg/list.py index dca73393..4bc24f7d 100644 --- a/borgmatic/borg/list.py +++ b/borgmatic/borg/list.py @@ -1,7 +1,5 @@ import logging import subprocess -import sys -import tempfile from borgmatic.verbosity import VERBOSITY_SOME, VERBOSITY_LOTS @@ -29,7 +27,5 @@ def list_archives(verbosity, repository, storage_config, local_path='borg', remo logger.debug(' '.join(full_command)) - with tempfile.TemporaryFile() as f_output: - subprocess.check_call(full_command, stdout=f_output) - f_output.seek(0) - return f_output.read().decode() + output = subprocess.check_output(full_command) + return output.decode() if output is not None else None diff --git a/borgmatic/tests/unit/borg/test_list.py b/borgmatic/tests/unit/borg/test_list.py index f0e178da..48bd095a 100644 --- a/borgmatic/tests/unit/borg/test_list.py +++ b/borgmatic/tests/unit/borg/test_list.py @@ -8,7 +8,7 @@ from borgmatic.verbosity import VERBOSITY_SOME, VERBOSITY_LOTS def insert_subprocess_mock(check_call_command, **kwargs): subprocess = flexmock(module.subprocess) - subprocess.should_receive('check_call').with_args(check_call_command, stdout=object, **kwargs).once() + subprocess.should_receive('check_output').with_args(check_call_command, **kwargs).once() LIST_COMMAND = ('borg', 'list', 'repo')