Skip to content

Commit

Permalink
Except AttributeError on sys.stdin.fileno() for Windows IIS10 (#1947
Browse files Browse the repository at this point in the history
)

* Update _subprocess.py

[Montag 15:19] Fassel Andreas (BSH GDS-BCL3)


If you start uvicorn in the context of Windows IIS10 no stdin exists, but exception is not OSError, but AttributeError
with uvicorn-0.21.1.dist-info

* Update uvicorn/_subprocess.py

* Update uvicorn/_subprocess.py

* Update _subprocess.py

---------

Co-authored-by: nurseomit <131279907+nurseomit@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
  • Loading branch information
3 people authored Feb 29, 2024
1 parent ed2d655 commit 93897b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions uvicorn/_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
from multiprocessing.context import SpawnProcess
from socket import socket
from typing import Callable, Optional
from typing import Callable

from uvicorn.config import Config

Expand All @@ -34,10 +34,10 @@ def get_subprocess(
"""
# We pass across the stdin fileno, and reopen it in the child process.
# This is required for some debugging environments.
stdin_fileno: Optional[int]
try:
stdin_fileno = sys.stdin.fileno()
except OSError:
# The `sys.stdin` can be `None`, see https://docs.python.org/3/library/sys.html#sys.__stdin__.
except (AttributeError, OSError):
stdin_fileno = None

kwargs = {
Expand Down

0 comments on commit 93897b5

Please sign in to comment.