git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re:

From
René Scharfe <l.s.r@web.de>
Date
Feb 27, 2018, 10:26 UTC
Message-ID
<d842741d-c079-3222-3655-cdd426ff0516@web.de>
In-Reply-To
<CAJTBYTnA56peLi4Cb0ZEx1PtOmh8eRF45tQgE=prwF_o7FDMcA@mail.gmail.com>
Am 27.02.2018 um 02:18 schrieb Alan Gage:
Show 9 quoted lines
> Hello, I recently noticed a bug involving GitBash and Python. I was
> running a function that would post the system time once every second
> using a while loop but the text was only sent after the while loop
> ended due to a timer I had set. Essesntially, instead of it being
> entered every second into the terminal, it was entered all at once,
> when the loop ended. I tried this with the Command Line, among other
> things, and it worked as intended, with the text being entered every
> second. This is on Windows 10 Pro with the Fall Creators Update and
> the most recent version of GitBash.

Python buffers its output by default. On terminals it enables line buffering, i.e. the accumulated output is flushed when a newline character is reached. Otherwise it uses a system-dependent buffer size in the range of a few kilobytes. You can check if your output is a terminal e.g. with:

  python -c "import sys; print(sys.stdout.isatty())"

You can disable buffering by running your script with "python -u". This discussion mentions more options:

  https://stackoverflow.com/questions/107705/disable-output-buffering

You can also start bash on the command line. I do wonder why Git CMD seems to be started in what passes as a terminal, while Git BASH is not, though.

You may want to check out https://gitforwindows.org/ and report your findings using their issue tracker.

(This mailing list here, git@vger.kernel.org, is mostly used for discussing Git itself, not so much about extra tools like bash or Python that are packaged with Git for Windows.)

René
Previous: Alan Gage
Message 2 of 2 in “”
  1. Alan GageFeb 27, 2018
  2. René ScharfeFeb 27, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.