Skip to content

Commit c2e66dd

Browse files
committed
fix: ensure flush that free thread on windows will not flush
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
1 parent 8b93ec3 commit c2e66dd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/profiling/sampling/_sync_coordinator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ def _execute_module(module_name: str, module_args: List[str]) -> None:
149149
pass
150150
except Exception as e:
151151
raise TargetError(f"Error executing module '{module_name}': {e}") from e
152+
finally:
153+
sys.stdout.flush()
154+
sys.stderr.flush()
152155

153156

154157
def _execute_script(script_path: str, script_args: List[str], cwd: str) -> None:
@@ -198,6 +201,9 @@ def _execute_script(script_path: str, script_args: List[str], cwd: str) -> None:
198201
pass
199202
except Exception as e:
200203
raise TargetError(f"Error executing script '{script_path}': {e}") from e
204+
finally:
205+
sys.stdout.flush()
206+
sys.stderr.flush()
201207

202208

203209
def main() -> NoReturn:

0 commit comments

Comments
 (0)