Przeglądaj źródła

Attempt to fix no-repro test failure of log_outputs() (#339).

Dan Helfman 4 lat temu
rodzic
commit
0a659a397f
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      borgmatic/execute.py

+ 6 - 1
borgmatic/execute.py

@@ -84,9 +84,14 @@ def log_outputs(processes, exclude_stdouts, output_log_level, borg_local_path):
 
 
                 logger.log(output_log_level, line)
                 logger.log(output_log_level, line)
 
 
+        still_running = False
+
         for process in processes:
         for process in processes:
             exit_code = process.poll() if output_buffers else process.wait()
             exit_code = process.poll() if output_buffers else process.wait()
 
 
+            if exit_code is None:
+                still_running = True
+
             # If any process errors, then raise accordingly.
             # If any process errors, then raise accordingly.
             if exit_code_indicates_error(process, exit_code, borg_local_path):
             if exit_code_indicates_error(process, exit_code, borg_local_path):
                 # If an error occurs, include its output in the raised exception so that we don't
                 # If an error occurs, include its output in the raised exception so that we don't
@@ -108,7 +113,7 @@ def log_outputs(processes, exclude_stdouts, output_log_level, borg_local_path):
                     exit_code, command_for_process(process), '\n'.join(last_lines)
                     exit_code, command_for_process(process), '\n'.join(last_lines)
                 )
                 )
 
 
-        if all(process.poll() is not None for process in processes):
+        if not still_running:
             break
             break
 
 
     # Consume any remaining output that we missed (if any).
     # Consume any remaining output that we missed (if any).