Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an issue on Python3 with our stderr redirecting. #77

Merged
merged 3 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Fx](http://rodeofx.com) and [Oblique](http://obliquefx.com). It is now part of
initiative](https://github.com/shotgunsoftware).

This software is provided under the MIT License that can be found in the LICENSE
file or at the [Open Source Initiative](http://www.opensource.org/licenses/mit-
license.php) website.
file or at the [Open Source Initiative](http://www.opensource.org/licenses/mit-license.php) website.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just spotted the link formatting was broken here.



## Overview
Expand Down
5 changes: 4 additions & 1 deletion src/daemonizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ def _daemonize(self):
sys.exit(1)

# redirect standard file descriptors
# unless specified when instantiating the class the will
# by default redirect the stdin, stdout, stderr to a null file
# which is the equivalent of discarding the output.
sys.stdout.flush()
sys.stderr.flush()
si = open(self._stdin, "r")
so = open(self._stdout, "a+")
se = open(self._stderr, "a+", 0)
se = open(self._stderr, "a+b", 0)
os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno())
Expand Down