`list_archives()` uses `subprocess.check_output()`
instead of `subprocess.check_call(..., stdout=temp_file)`
This commit is contained in:
parent
76b5953959
commit
7a4c41c12c
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue