Re: [mingw32] stdin redirection

Joel Brobecker
2007-04-12T16:29:36Z

> If it helps, I believe that when I was testing that code I had an ssh
> session open from a Linux desktop to my Cygwin system using Cygwin
> sshd, and was running GDB in there. That definitely triggers the pipe
> case.

That's what I'm doing too. Here are the results of some experiments.
This is with GDB 6.6 but I believe everything should be relevant.
Here are the results of the testing:

Unmodified debugger:

1. Interactive mode: fd_is_pipe returns 1
Works.

2. File handle ("gdb < cmds"): fd_is_pipe return 0
Hangs

3. Pipe handle ("cat cmds | gdb"): fd_is_pipe return 1
Works, except that I suspect that the EOF is detected as an
exception condition:
(gdb) Exception condition detected on fd 0
error detected on stdin

Modified debugger (always return 0 in fd_is_pipe): Works in all 3 cases.
I tried:

% (echo "pwd"; sleep 10; echo "pwd") | ./gdb

That worked as well. This confirms your own experience that any
failure is not immediately obvious...

> Of course the console will be a little wonky because of buffering.

Based on one of your recommendation, I modified our sources a while
ago to fix the flushing so that the output would not be garbled.
I offered to post a patch, but noone reacted. I'm reiterating the
offer today...

--
Joel