7

I am using Git Bash to run a simple local server with $ python3 -m http.server 8000

Git Bash never prints that it is running and does not get a log of the requests. I can access http://localhost:8000/ so the command is working. How do I get git bash to print the log?

1

2 Answers 2

9

This appears to be a general issue with line-buffering under mingw. You should be able to work around this by avoiding buffering the outputs, which in your case is possible through

$ python -u -m http.server 8080

This works as expected on

$ uname -a
MINGW64_NT-6.3 - 2.5.0(0.295/5/3) 2016-03-31 18:47 x86_64 Msys
Sign up to request clarification or add additional context in comments.

Comments

1

From looking at "what" Git Bash, it would seem to be a cut down version of cygwin. I have just run "python3 -m http.server 8000", and get the following log output:

$ python3 -m http.server 8000
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [04/Jun/2017 20:15:10] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [04/Jun/2017 20:15:10] code 404, message File not found
127.0.0.1 - - [04/Jun/2017 20:15:10] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [04/Jun/2017 20:15:10] code 404, message File not found
127.0.0.1 - - [04/Jun/2017 20:15:10] "GET /favicon.ico HTTP/1.1" 404 -

It would seem that git bash is not logging (outputting) correctly.

Trying running "python3 -m http.server 8000" in virtualbox / vagrant -> with Ubuntu or Centos.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.