Skip to content

Commit

Permalink
pyp: signal.signal(signal.SIGPIPE, signal.SIG_DFL)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Nov 3, 2024
1 parent 5af2a58 commit 2e67793
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 2e67793

Please sign in to comment.