From 283d8245e148a886d707db76ad09a5ef49de5162 Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Fri, 17 Mar 2023 17:14:34 +0545 Subject: [PATCH] flush streams before fork (#9203) --- dvc/daemon.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dvc/daemon.py b/dvc/daemon.py index 2fd216b79..874627e43 100644 --- a/dvc/daemon.py +++ b/dvc/daemon.py @@ -56,6 +56,11 @@ def _spawn_windows(cmd, env): def _spawn_posix(cmd, env): from dvc.cli import main + if sys.stdout and not sys.stdout.closed: + sys.stdout.flush() + if sys.stderr and not sys.stderr.closed: + sys.stderr.flush() + # NOTE: using os._exit instead of sys.exit, because dvc built # with PyInstaller has trouble with SystemExit exception and throws # errors such as "[26338] Failed to execute script __main__"