question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Terminal is not cleaned up when I quit the fastAPI server with ctrl+c

See original GitHub issue

image

Like 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tiangolocommented, Nov 9, 2022

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 long delay! 🙈 I wanted to personally address each issue/PR and they piled up through time, but now I’m checking each one in order.

1reaction
jsrimrcommented, Sep 24, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found