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

Windows does not support os.fork #143

Open
SystemPanic opened this issue Oct 19, 2023 · 1 comment
Open

Windows does not support os.fork #143

SystemPanic opened this issue Oct 19, 2023 · 1 comment
Labels
enhancement New feature or request windows

Comments

@SystemPanic
Copy link

SystemPanic commented Oct 19, 2023

Describe the bug
Windows does not support os.fork

Starting a socketify ASGI, for example falcon, raises AttributeError: module 'os' has no attribute 'fork'

To Reproduce
Steps to reproduce the behavior:

  1. Create a file called falcon_test.py with the following code:
import falcon
import falcon.asgi
from socketify import ASGI

class Test:
    async def on_get(self, req, resp):
        """Handles GET requests"""
        resp.status = falcon.HTTP_200  # This is the default status
        resp.content_type = falcon.MEDIA_TEXT  # Default is JSON, so override
        resp.text = (
            '\nTwo things awe me most, the starry sky '
            'above me and the moral law within me.\n'
            '\n'
            '    ~ Immanuel Kant\n\n'
        )

app = falcon.asgi.App()
test = Test()
app.add_route('/', test)

if __name__ == "__main__":
    ASGI(app).listen(5000, lambda config: print(f"Listening on port http://localhost:{config.port} now\n")).run(workers=8)
  1. Call python falcon_test.py

Expected behavior
ASGI server running on Windows.

@cirospaciari cirospaciari added windows enhancement New feature or request labels Oct 19, 2023
@cirospaciari
Copy link
Owner

cirospaciari commented Oct 19, 2023

For now, we depend on os.fork so windows is not supported yet, but will add this feature in windows in the future for sure multiprocessing should do the trick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request windows
Projects
None yet
Development

No branches or pull requests

2 participants