Mail Archives: cygwin/2006/05/07/15:23:22
Hmmm... I'll take a look at your code if I get time, but here's an
inefficient (yet simple) solution that would at least work: You could
start Cygwin/bash in an invisible DOS prompt window, and send commands
to it by simulating keystrokes (PostMessage or SendMessage...
WM_KEYDOWN, WM_KEYUP). Yeah, it's sloppy, but it would probably do
the trick.
On 4/21/06, Dave <kilroyd AT googlemail DOT com> wrote:
> 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/
>
>
--
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 -