Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com Date: Sun, 23 May 1999 23:37:57 +0400 From: Egor Duda X-Mailer: The Bat! (v1.029) S/N A0F2A05A Reply-To: Egor Duda Organization: DEO Message-ID: <15984.990523@logos-m.ru> To: cygwin-developers Subject: bash fails to handle background jobs Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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