From 2e677939dbdc381dec1d3b297aee3c76d9e5d337 Mon Sep 17 00:00:00 2001 From: Shantanu Jain Date: Sat, 2 Nov 2024 20:04:47 -0700 Subject: [PATCH] pyp: signal.signal(signal.SIGPIPE, signal.SIG_DFL) --- pyp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyp.py b/pyp.py index 7c39564..9e018fe 100644 --- a/pyp.py +++ b/pyp.py @@ -577,7 +577,11 @@ def build(self) -> ast.Module: self.build_missing_imports() ret = ast.parse("") - ret.body = self.before_tree.body + self.tree.body + self.after_tree.body + if sys.platform != "win32": + ret.body = ast.parse( + "import signal\nsignal.signal(signal.SIGPIPE, signal.SIG_DFL)" + ).body + ret.body += self.before_tree.body + self.tree.body + self.after_tree.body # Add fake line numbers to the nodes, so we can generate a traceback on error i = 0 for node in dfs_walk(ret):