This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Redirecting bash stdin


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]