Capture external command output line by line on Windows 98

D

Dib Urim

Hello,

I'm trying to Capture external command output and error line by line.
I wrote this example witch work excellent on Windows 2000:

open(PROC,"DIR 2>&1 |");
while(<PROC>) {
print ("LINE:$_");
}
close(PROC);

But on Windows 98 it don't do nothing!
I'm user perl 5.6.1 activestate 625.
I need to display the output line by line and not all at once
so I can't use system command.
How can I implement it on windows 98 ?

Thanks
Dib
 
B

Ben Liddicott

Hi Dib,

DIR is a built in to the command interperter, command.com.

You have to do this:

open(PROC, "command.com /c DIR |");

Cheers,
Ben Liddicott
 
D

Dib Urim

Hello Ben,

Thank for you quick replay.
What abut command/utils that are not in the command interpreter.
Specially I need to capture the output/error of utility called rsync.exe

Dib
 
J

James Willmore

I'm trying to Capture external command output and error line by
line. I wrote this example witch work excellent on Windows 2000:

open(PROC,"DIR 2>&1 |");
while(<PROC>) {
print ("LINE:$_");
}
close(PROC);

But on Windows 98 it don't do nothing!
I'm user perl 5.6.1 activestate 625.
I need to display the output line by line and not all at once
so I can't use system command.
How can I implement it on windows 98 ?

For an idiomatic Perl solution, type:
perldoc -q "STDERR"

This will produce perlfaq8, which approaches the question ...
"How can I capture STDERR from an external command?"

You could also use Google, using the following keywords:
"comp.lang.perl.misc STDERR capture"

This query gives, again, idiomatic Perl solutions. For OS specific
solutions, use whatever command you execute at the command line in the
system call.

This question has been asked and answered before - so the solution is
available to you :)

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
The right half of the brain controls the left half of the body.
This means that only left handed people are in their right mind.
 
B

Ben Liddicott

Hi Dib,

I really don't know whether you can do this in Win98. Sorry.

I suggest you try a Windows newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top