File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 33import logging
44import os
55import queue
6+ import subprocess
67import threading
78import time
89from enum import Enum
@@ -383,6 +384,7 @@ def parse_stderr(line: str):
383384
384385 rsync_cmd .extend (["." , self ._remote ])
385386
387+ result : subprocess .CompletedProcess | None = None
386388 success = True
387389 if rsync_stdin :
388390 result = procrunner .run (
@@ -394,7 +396,7 @@ def parse_stderr(line: str):
394396 print_stdout = False ,
395397 print_stderr = False ,
396398 )
397- success = result .returncode == 0
399+ success = result .returncode == 0 if result else False
398400
399401 if rsync_stdin_remove :
400402 rsync_cmd .insert (- 2 , "--remove-source-files" )
@@ -409,7 +411,7 @@ def parse_stderr(line: str):
409411 )
410412
411413 if success :
412- success = result .returncode == 0
414+ success = result .returncode == 0 if result else False
413415
414416 self .notify (successful_updates , secondary = True )
415417
@@ -429,8 +431,11 @@ def parse_stderr(line: str):
429431 self .notify (update )
430432 success = False
431433
432- logger .log (
433- logging .WARNING if result .returncode else logging .DEBUG ,
434- f"rsync process finished with return code { result .returncode } " ,
435- )
434+ if result is None :
435+ logger .error (f"No rsync process ran for files: { files } " )
436+ else :
437+ logger .log (
438+ logging .WARNING if result .returncode else logging .DEBUG ,
439+ f"rsync process finished with return code { result .returncode } " ,
440+ )
436441 return success
You can’t perform that action at this time.
0 commit comments