List Info

Thread: Capturing command window output




Capturing command window output
user name
2006-12-29 18:44:48
Dear Perl/Win32 Gurus,

I have a Perl script which is triggered every minute (to
check for
something) to complete a complex task that some users would
rather not
perform themselves.  Of course, they're having mysterious
trouble that is
not easily reproducible, so I would like to create a more
extensive log
and mail it to myself.

The Perl script appears as a basic command shell, fired off
by the
Scheduled Tasks part of Windows.  Various technical commands
come and go,
with little bits to tell them how close they are to being
done.  I have to
call upon assorted executables in this process, third-party
executables
for which I have no source code.  I suspect either my users
or the
executables are causing the trouble, but I can't sit down
there and watch
my users, nor are they writing down any messages.

Does a way exist to capture everything in that command shell
window prior
to exit?

Right now, I'm just appending to a logging message, and
adding things to
it like the output from each and every "$shelloutput =
qx/$shellcommand
2>&1/;" I fire off, but I suspect there's a
smarter way that I have
completely missed.

Of course, I'd like to see STDERR as much as STDOUT.

Thanks for your time,

Ian

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Weblistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
Capturing command window output
user name
2006-12-30 15:13:29
Have you tried launching an app like opening a file?
open ('cmd dir |');

Notice the pipe character at the end.

ianmbrick.net wrote:
> Dear Perl/Win32 Gurus,
>
> I have a Perl script which is triggered every minute
(to check for
> something) to complete a complex task that some users
would rather not
> perform themselves.  Of course, they're having
mysterious trouble that is
> not easily reproducible, so I would like to create a
more extensive log
> and mail it to myself.
>
> The Perl script appears as a basic command shell, fired
off by the
> Scheduled Tasks part of Windows.  Various technical
commands come and go,
> with little bits to tell them how close they are to
being done.  I have to
> call upon assorted executables in this process,
third-party executables
> for which I have no source code.  I suspect either my
users or the
> executables are causing the trouble, but I can't sit
down there and watch
> my users, nor are they writing down any messages.
>
> Does a way exist to capture everything in that command
shell window prior
> to exit?
>
> Right now, I'm just appending to a logging message, and
adding things to
> it like the output from each and every
"$shelloutput = qx/$shellcommand
> 2>&1/;" I fire off, but I suspect there's a
smarter way that I have
> completely missed.
>
> Of course, I'd like to see STDERR as much as STDOUT.
>
> Thanks for your time,
>
> Ian
>
> _______________________________________________
> Perl-Win32-Web mailing list
> Perl-Win32-Weblistserv.ActiveState.com
> To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
>   

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Weblistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )