Mail Archives: cygwin-developers/1999/05/23/15:41:32
Hi!
Trying to run background jobs in bash causes it to exit. According
to traces, is seems that when background job exits, pty-master writes
dummy data to tty_slave:
fhandler_pty_master::accept_input ()
{
DWORD written;
DWORD n = eat_readahead (-1); // returns 0;
const char dummy[1] = {'X'};
const char *buf;
if (n != 0)
buf = rabuf;
else
{
n = 1;
buf = dummy;
}
termios_printf ("about to write %d chars to slave", n);
if (!WriteFile (get_output_handle (), buf, n, &written, NULL))
return -1;
return buf == dummy ? 0 : (int)n;
/* returns 0, but still puts 1 byte of data into the pipe between
* master and slave. Later on, peek_pipe () detects this data and
* marks slave as "ready to read". Slave tries to read, retrives 0
* bytes (as long tc->read_retval is set to 0 in
* fhandler_termios.cc:191) and interprets it as EOF. bash sees
* EOF and exits.
*/
}
Applying following patch seems to fix a problem, but it really looks
like quick'n'dirty workaround to me. i'm not so good with tty stuff,
so i hope someone will find a way to fix this problem properly.
Index: fhandler_tty.cc
===================================================================
RCS file: /usr/local/src/cvs/cygnus/cygwin/winsup/fhandler_tty.cc,v
retrieving revision 1.1.1.1
diff -u -2 -r1.1.1.1 fhandler_tty.cc
--- fhandler_tty.cc 1999/04/10 14:55:01 1.1.1.1
+++ fhandler_tty.cc 1999/05/23 19:25:05
@@ -136,5 +136,5 @@
else
{
- n = 1;
+ n = 0;
buf = dummy;
}
Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19
- Raw text -