cygwin: output freezes until program is finished

1

I use cygwin at Windows XP.

There's problem with Mercurial, for example.

Say, I need to push my repo with several subrepos to the remote server. This operation takes about 20 seconds.

When I call hg from cmd.exe, I see all actions in real-time:

pushing subrepo ..... to .....
searching for changes

etc. Everything is fine.

But, when I call it from cygwin terminal, I type hg push, press Enter, and there's nothing echoed to the console for about 20 seconds, and then all the logs appear immediately.

Why is that, and how can I avoid that?

Dmitry Frank

Posted 2013-08-04T15:46:57.647

Reputation: 699

The cygwin shell uses pipes to direct output which programs often assume are non-interactive (they don't see them as a TTY / console). The result is they often buffer output in 4k chunks for performance reasons. Have not seen a general solution to this. – Brian – 2013-08-04T16:08:46.137

But, when I type, say, ping google.com, I see real-time action of it – Dmitry Frank – 2013-08-04T17:14:21.363

Depends on the command / executable. Some always line buffer so won't be a problem. – Brian – 2013-08-04T17:17:56.497

I use mercurial under cygwin, and I don't have the described problem. Is this a "native" Windows version of mercurial, or cygwin's version? If the former, try the latter. – Heptite – 2013-08-04T19:57:31.150

This is a "native" Windows version, yes. It contains some useful features such as overlay icons and TortoiseHG GUI, cygwin's version seems not have them. Thanks for the suggestion, I'm out of my dev environment for several days, but I'll definitely try it later, anyway. – Dmitry Frank – 2013-08-04T22:01:15.957

My comment has been added as an answer. – Heptite – 2013-08-05T22:11:17.243

Answers

1

I use mercurial under cygwin, and I don't have the described problem. Is this a "native" Windows version of mercurial, or cygwin's version? If the former, try the latter.

Heptite

Posted 2013-08-04T15:46:57.647

Reputation: 16 267

1

I know this is an old thread but I've experienced this issue for the past 3 years. And after about a month of it, i was coming apart at the seams and could take it no longer. It may be a little blunt, or heavy handed but it works...and has been working for 2.75 years without issue.

Here's what kept my laptop from winding up in the street

$ ln -s `where ping.exe | grep -v rh` /usr/bin/ping.exe

Here's how I arrived there...

david@Covet ~
$ which ping.exe
/usr/bin/ping.exe

david@Covet ~
$ /usr/bin/ping.exe
Usage:  ping [-dfqrv] host [packetsize [count [preload]]]

david@Covet ~
$ where ping.exe
C:\rhcygwin64\bin\ping.exe
C:\Windows\System32\PING.EXE

david@Covet ~
$ mv /usr/bin/ping.exe /usr/bin/cyping.exe

david@Covet ~
$ ln -s `where ping.exe | grep -v rh` /usr/bin/ping.exe

david@Covet ~
$ which ping
/usr/bin/ping

david@Covet ~
$ ping

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
            [-r count] [-s count] [[-j host-list] | [-k host-list]]
            [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name

Options:
    -t             Ping the specified host until stopped.
                   To see statistics and continue - type Control-Break;
                   To stop - type Control-C.
    -a             Resolve addresses to hostnames.
    -n count       Number of echo requests to send.
    -l size        Send buffer size.
    -f             Set Don't Fragment flag in packet (IPv4-only).
    -i TTL         Time To Live.
    -v TOS         Type Of Service (IPv4-only. This setting has been deprecated
                   and has no effect on the type of service field in the IP Header).
    -r count       Record route for count hops (IPv4-only).
    -s count       Timestamp for count hops (IPv4-only).
    -j host-list   Loose source route along host-list (IPv4-only).
    -k host-list   Strict source route along host-list (IPv4-only).
    -w timeout     Timeout in milliseconds to wait for each reply.
    -R             Use routing header to test reverse route also (IPv6-only).
    -S srcaddr     Source address to use.
    -4             Force using IPv4.
    -6             Force using IPv6.

david@Covet ~
$ ping -t 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=13ms TTL=54
Reply from 8.8.8.8: bytes=32 time=13ms TTL=54
Reply from 8.8.8.8: bytes=32 time=13ms TTL=54
Reply from 8.8.8.8: bytes=32 time=13ms TTL=54
Reply from 8.8.8.8: bytes=32 time=13ms TTL=54
Reply from 8.8.8.8: bytes=32 time=14ms TTL=54
Reply from 8.8.8.8: bytes=32 time=14ms TTL=54


david@Covet ~
$

I hope this helps someone, anyone like it's helped me.

David Dionne

Posted 2013-08-04T15:46:57.647

Reputation: 11

0

I know when implementing command line code in C/C++ this behavior can be controlled by the fflush() command to flush an output buffer, fclose() would do the same thing.

So, it's dependent on the program you're running and how often they flush().

The Dave

Posted 2013-08-04T15:46:57.647

Reputation: 24