From ed46a472a1e35074359d02a655bbe8b2312f702d Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Tue, 3 Dec 2019 07:29:52 +0100 Subject: [PATCH] resolve exit code for backup_from_stdin --- restic_volume_backup/restic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/restic_volume_backup/restic.py b/restic_volume_backup/restic.py index 7d150d3..1b2067b 100644 --- a/restic_volume_backup/restic.py +++ b/restic_volume_backup/restic.py @@ -42,7 +42,11 @@ def backup_from_stdin(repository: str, filename: str, source_command: List[str]) # pipe source command into dest command source_process = Popen(source_command, stdout=PIPE) dest_process = Popen(dest_command, stdin=source_process.stdout) - return dest_process.communicate() + dest_process.communicate() + + # Ensure both processes exited with code 0 + source_exit, dest_exit = source_process.poll(), dest_process.poll() + return source_exit == 0 and dest_exit == 0 def snapshots(repository: str):