-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix for running in pythonw #2448
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2448 +/- ##
=============================================
+ Coverage 87.267% 87.269% +0.002%
=============================================
Files 60 60
Lines 5097 5098 +1
Branches 913 913
=============================================
+ Hits 4448 4449 +1
Misses 476 476
Partials 173 173
Continue to review full report at Codecov.
|
@timmo001 I am sorry, in my head I was looking at the original logic thinking that it was wrong. That is why I suggested the change. But, it was correct. I reverted the PR back to your original suggestion. Let's pretend I never suggested that to begin with 😆 Thanks for catching this for us. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a suggestion that ACTUALLY makes sense...
There are a few more places that follow a similar pattern. Perhaps you can add the same change:
sanic/mixins/runner.py:427: if sys.stdout and sys.stdout.isatty() and not self.state.is_debug:
sanic/mixins/runner.py:618: if sys.stdout.isatty():
sanic/mixins/runner.py:659: if sys.stdout.isatty():
sanic/log.py:86: if sys.stdout.isatty():
sanic/application/motd.py:39: motd_class = MOTDTTY if sys.stdout.isatty() else MOTDBasic
sanic/application/logo.py:47: if sys.stdout.isatty()
Maybe we can add a function into ./compat.py
:
def is_atty():
return sys.stdout and sys.stdout.isatty()
Update on this? I see its been approved but the checks are failing. |
I've rebased, but this requires an approver to run |
Fixed lint, needs approval |
Schedule for the next release? |
Should be this week. |
Running sanic server on windows and on
pythonw.exe
causes the app to silently crash due tosys.stdout
being None.This adds a check for stdout. The rest of the server then continues to function normally.