Re: Writing to others Process STDIN



On Tue, 21 Jun 2005 18:08:58 +0200, Egon Rath wrote:

> On Mon, 20 Jun 2005 19:05:27 +0200, Egon Rath
> <egon-nospam@xxxxxxxxxxx> wrote:
>
>>Hi,
>>
>>i am trying to write to a other's process standard input. I've played
>>around with the OpenProcess and DuplicateHandle Functions - without
>>any success.
>>
>>below is my test code (compiles but doesn't work)
>>
>
> Hi,
>
> first of all, thank you for answering.
>
> Ok, the part with the source/target is now clear. I've read in the
> MSDN Documentation to DuplicateHandle that it only works for
> duplicating Console Input/Output Handles if the Process is a child of
> the calling process where the Duplication should occur.
>
> The situation i need to master is as follows:
>
> We are running a application which consists of about 30 open command
> line windows where in each of this windows runs a Java Process.
> Sometimes when a complex bug in this application occurs it's necessary
> to step through all of these windows, enlarge the console buffer to as
> many lines as possible, then press Ctrl-Break, mark the entire output
> (Java Stack Trace), copy each of the output to a text file ... and so
> on....
>
> I want to develop a way of automating this process. Do you have any
> ideas how i could do this with the Win32 API?

I gotta tell you, my first choice would not be to try to iterate these
windows and look into their console buffers. Some ideas:

1. Is there a Java debug mode that will send stack traces and the like to a
designated place?

2. Is there any way you can catch the exception and send it where you want
it?

3. Can you launch the processes with a redirected stderr?

--
Doug Harrison
Microsoft MVP - Visual C++
.



Relevant Pages

  • Re: subprocess.Popen inheriting
    ... Windows, you need to call DuplicateHandle for it. ... There's also the complicating factor that the handles in windows aren't   ... This still doesn't answer whether the file descriptor return by ...
    (comp.lang.python)
  • Re: Writing to others Process STDIN
    ... >around with the OpenProcess and DuplicateHandle Functions - without ... line windows where in each of this windows runs a Java Process. ... (Java Stack Trace), copy each of the output to a text file ... ...
    (microsoft.public.vc.language)
  • Re: subprocess.Popen inheriting
    ... Windows, you need to call DuplicateHandle for it. ... There's also the complicating factor that the handles in windows aren't the ... It would be nice if Python created pipes that are properly inheritable by ...
    (comp.lang.python)