> Can you get by without the pipe and do something simpler with a file
> and Win32::Process ? :
> 
> use Win32::Process;
> 
> my $pObj;
> my $file = "C:\\test.log";
> 
> Win32::Process::Create($pObj, "$ENV{WINDIR}\\system32\\cmd.exe",
>   "cmd /C dir 2>&1 >$file", 0, NORMAL_PRIORITY_CLASS, "C:\\") or
>   die "Create: $! ($^E)";
> 
> open IN, $file or die "open $file: $! ($^E)";
> print <IN>;
> close IN;

Not in that particular way (direct to file), because we need realtime
monitoring of the logs to send emails if certain lines pass the filters.
I was doing an open PROCESS, "cmd /c app.exe 2>&1 |" type thing, but it
was annoying seeing all those cmd.exes running, especially when there
were 25 of them, plus the service has to watch the child pid and warn if
it goes down, so I had to do a wmi 'get processes which are child of
cmd.exe x' type thing.

I could revert to this if needed, but obviously the pipe is prettier, if
apparently the most unstable thing in the entire world :)

Paul

*****************************************************************
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.
*****************************************************************


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to