Terminal is not cleaned up when I quit the fastAPI server with ctrl+c
See original GitHub issueLike above picture, I finished the server with ctrl+c. However, the terminal I was using is still freezed, so I need to open another fresh terminal if I want to start the server again.
Temporarily, I find the fastAPI process with ps -ef | grep fast
and kill that process with kill -9 [pid]
. This ends up the server and leave terminal cleanly, but too burdensome.
Is there anyway to use ctrl+c more smartly or any other practical alternatives? Thx
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
FastAPI is not quitting when pressing Ctr+c - Stack Overflow
This what I get when I run it and then try to quit, the process hangs and does not go back to terminal:...
Read more >Run a Server Manually - Uvicorn - FastAPI
The main thing you need to run a FastAPI application in a remote server machine is an ASGI server program like Uvicorn. There...
Read more >About ctrl C not working in terminal. - Apple Community
About ctrl C not working in terminal. why ctrl c in not working to exit from docker local server and to exit from...
Read more >Quickstart: Python + Phusion Passenger
Stopping the server. There are two ways to stop the server. The first is by pressing Ctrl-C in the terminal. Copy. Copy
Read more >Using FastAPI to Build Python Web APIs - Real Python
$ uvicorn main:app --reload INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started reloader process [28720] INFO: Started server ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the help here @raphaelauv! 🍪
And thanks for coming back to close the issue @jsrimr ☕
…there’s a chance that you are on Windows and you had selected text in the terminal. In Windows, that freezes everything until you hit enter, that copies that text and lets things continue working… because Windows 😅
Sorry for the late reply. I tried your code and it terminated gracefully. It doesn’t seem a matter of terminal configuration. I will research more and come next time.