Thread View: comp.lang.pascal.delphi.misc
3 messages
3 total messages
Started by Murray McCulloch
Tue, 20 Jan 2004 23:26
Problem writing to stdin of a console program (cvs.exe). Help?
Author: Murray McCulloch
Date: Tue, 20 Jan 2004 23:26
Date: Tue, 20 Jan 2004 23:26
36 lines
2661 bytes
2661 bytes
I'm trying to control CVS from a GUI application. I have no trouble executing cvs.exe and collecting its output, but I've had no luck trying to send input to it when it prompts for a password (cvs logon command). I'm creating a pipe and setting the hStdInput field of TStartupInfo to the read end before I create the process. Same thing with hStdOut and hStdIn (using a second pipe of course). Peeking at the stdout pipe, I see CVS's password prompt. But when I try to write to the stdin pipe, I get an invalid handle error. I've tried WriteFile(), WriteConsole() and WriteConsoleInput(). Another hint that something is wrong is that the CVS process seems to run away - CPU goes to 100% and the process doesn't end until I kill it. It's no surprise that it doesn't end, since it's waiting for input, but why the 100% CPU time? I thought this might be something to do with the cvs.exe itself -- I read somewhere that not all programs are written in a way that they will allow you to redirect standard input. So I tried to write a simple console app of my own to test the theory, but I couldn't even get my own app to redirect output, let alone input. (It was a simple writeln/readln thing -- I guess I needed to do more?) I've read tons of threads about redirecting output and input of console programs and tried everything I've read, but I cannot get cvs.exe to accept my input. If anyone has any thoughts about what I might be doing wrong, or happens to know if CVS just won't allow this (and if so, is there a work-around?), your replies would be greatly appreciated. I've had the same results from both CVSNT and the bona fide CVS Win32 binary. Cheers, MM
Re: Problem writing to stdin of a console program (cvs.exe). Help?
Author: Jamie
Date: Wed, 21 Jan 2004 10:46
Date: Wed, 21 Jan 2004 10:46
42 lines
3175 bytes
3175 bytes
its most likely a protection of the password entry. you do not need to use the Io Stream to collect keyboard data. try looking at the keybd_event. look that up in the WIn32 Help. Murray McCulloch wrote: > I'm trying to control CVS from a GUI application. I have no trouble > executing cvs.exe and collecting its output, but I've had no luck > trying to send input to it when it prompts for a password (cvs logon > command). > > I'm creating a pipe and setting the hStdInput field of TStartupInfo to > the read end before I create the process. Same thing with hStdOut and > hStdIn (using a second pipe of course). Peeking at the stdout pipe, I > see CVS's password prompt. But when I try to write to the stdin pipe, > I get an invalid handle error. I've tried WriteFile(), WriteConsole() > and WriteConsoleInput(). > > Another hint that something is wrong is that the CVS process seems to > run away - CPU goes to 100% and the process doesn't end until I kill > it. It's no surprise that it doesn't end, since it's waiting for > input, but why the 100% CPU time? > > I thought this might be something to do with the cvs.exe itself -- I > read somewhere that not all programs are written in a way that they > will allow you to redirect standard input. So I tried to write a > simple console app of my own to test the theory, but I couldn't even > get my own app to redirect output, let alone input. (It was a simple > writeln/readln thing -- I guess I needed to do more?) > > I've read tons of threads about redirecting output and input of > console programs and tried everything I've read, but I cannot get > cvs.exe to accept my input. If anyone has any thoughts about what I > might be doing wrong, or happens to know if CVS just won't allow this > (and if so, is there a work-around?), your replies would be greatly > appreciated. > > I've had the same results from both CVSNT and the bona fide CVS Win32 > binary. > > Cheers, > MM
Re: Problem writing to stdin of a console program (cvs.exe). Help?
Author: Murray McCulloch
Date: Wed, 21 Jan 2004 23:43
Date: Wed, 21 Jan 2004 23:43
8 lines
1395 bytes
1395 bytes
Thank you Jamie, that worked. :) MM Jamie <jamie_5_not_valid_after_5@charter.net> wrote in message news:<100sarbqjm7sv80@corp.supernews.com>... > its most likely a protection of the password entry. > you do not need to use the Io Stream to collect keyboard data. > try looking at the keybd_event. look that up in the WIn32 Help.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads