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

error :plug_cowboy #1142

Closed
alex1543 opened this issue Apr 9, 2023 · 4 comments
Closed

error :plug_cowboy #1142

alex1543 opened this issue Apr 9, 2023 · 4 comments

Comments

@alex1543
Copy link

alex1543 commented Apr 9, 2023

Dear Developer, help me understand.

:plug cowboy does not work under Windows. The example starts without errors, but the page does not open http://localhost:4000/
There is no plug in the process list "netstat -a -b". The bug manifests itself regardless of the port: 4000, 8181, 3000, 3001, etc.
How can the error be corrected?

  1. Operating system: Windows 11 Home, Version: 22H2, Build: 22621.1485;
  2. Version: Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns] and Elixir 1.14.4 (compiled with Erlang/OTP25)
  3. I run the example with the command: C:\Elixir\bin\elixir --no-halt hello_world.exs
    Grateful for any hint. Thank you for your attention to me.
    Example runs according to https://github.com/elixir-plug/plug
@josevalim
Copy link
Member

Can you try adding a Process.sleep(:infinity) as the last line of the file and see if that fixes it?

@alex1543
Copy link
Author

alex1543 commented Apr 9, 2023

Everything worked, thanks.

@yumaikas
Copy link

yumaikas commented Jul 5, 2023

Might I ask why this works?

@josevalim
Copy link
Member

Starting a supervision tree process does not block the main execution. So when the file finished, the whole program terminated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants