3

I am running the SimpleHTTPServer from powershell.

python -m SimpleHTTPServer 8080  

I want to exit (control + break) the server without closing the terminal. Any ideas?

Thanks in advance for any suggestions

bcollins
  • 3,379
  • 4
  • 19
  • 35
  • Check that link: http://stackoverflow.com/questions/12647196/how-do-i-shut-down-a-python-simplehttpserver – Rami Oct 08 '13 at 23:57
  • If you are using powershell 3, use the PSSession cmdlets to run it in a background, and control the parent process. – Eris Oct 09 '13 at 17:00
  • Here's another alternative. Ctrl Z: [http://superuser.com/a/262948](http://superuser.com/a/262948) – fa wildchild Apr 18 '15 at 14:12
  • 1
    You can see my answer http://stackoverflow.com/questions/12647196/how-do-i-shut-down-a-python-simplehttpserver/31334292#answer-31334292 in detail. – codersaif Sep 23 '15 at 19:54

1 Answers1

4

^C will close it (control + c)

Example of me testing control + c to send an interupt and exit:

PS C:\> python -m http.server 8080
Serving HTTP on 0.0.0.0 port 8080 ...

Keyboard interrupt received, exiting.

Note, I am using http.server as this replaces SimpleHTTPServer in Python 3 but it should work the same for you.

Nathan
  • 116
  • 9