From 0067bd36b51a369477df227ab94547b83fee7a59 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 28 Sep 2019 23:57:29 -0500 Subject: [PATCH] try to fix stdout broken pipe --- onionr/__init__.py | 9 +++++++++ onionr/onionrcommands/daemonlaunch.py | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/onionr/__init__.py b/onionr/__init__.py index 400e218f..54a41c21 100755 --- a/onionr/__init__.py +++ b/onionr/__init__.py @@ -60,3 +60,12 @@ def onionr_main(): if __name__ == "__main__": onionr_main() + + try: + sys.stderr.close() + except (IOError, BrokenPipeError) as e: + pass + try: + sys.stdout.close() + except (IOError, BrokenPipeError) as e: + pass diff --git a/onionr/onionrcommands/daemonlaunch.py b/onionr/onionrcommands/daemonlaunch.py index 335f738d..797860e1 100755 --- a/onionr/onionrcommands/daemonlaunch.py +++ b/onionr/onionrcommands/daemonlaunch.py @@ -114,14 +114,6 @@ def daemon(): except KeyboardInterrupt: pass cleanup.delete_run_files() - try: - sys.stderr.close() - except (IOError, BrokenPipeError) as e: - pass - try: - sys.stdout.close() - except (IOError, BrokenPipeError) as e: - pass def _ignore_sigint(sig, frame): '''This space intentionally left blank'''