delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/21/13:46:14

X-Spam-Check-By: sourceware.org
Message-ID: <44491A56.8030809@gmail.com>
Date: Fri, 21 Apr 2006 18:45:58 +0100
User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Redirecting bash stdin
From: Dave <kilroyd AT googlemail DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I'm trying to get a mingw GUI application to pipe commands to cygwins 
bash by redirecting its stdin as described here 
<http://support.microsoft.com/?id=190351>.

This nearly works.

1. Start app.
2. Spawn bash with redirected stdin. bash process visible in process 
explorer.
3. Send command1 to bash. No response.
4. Send command2 to bash. Response to command1 seen
5. Exit app. Response to command2 seen.

Command1 and command2 start notepad with different files, so the 
response I'm expecting is a visible notepad window.

I'm ensuring the commands are terminated with "&\n\0" and even tried 
"&\r\n\0" and "&\n\n\0".

I'm flushing the write end of the stdin pipe with FlushFileBuffers.

I've tried adding a 2nd WriteFile (just spaces and \n) to see if that 
flushes the buffer. It doesn't.

The Microsoft documentation states that it is the responsibility of the 
child process (bash) to empty its stdin.

I've tried a couple shells: ash and pdksh appear to work as expected. 
tcsh responds immediately but exits after the first command. zsh acts 
like bash.

Does anyone know what I can do to get bash to respond promptly? Or will 
this approach not work with bash?

If necessary I can put the code on the net somewhere.

Thanks,

Dave.

Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 4

cygwin1.dll version 1.5.19

GNU bash, version 3.00.16(14)-release (i686-pc-cygwin)
Copyright (C) 2004 Free Software Foundation, Inc.


PS If I can get it working, the above is intended for a revamped chere. 
So I need it to work with bash, since ash won't let me get a login shell 
and pdksh seems like an odd requirement.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019