Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Win32::Process and tee

by paulbort (Hermit)
on Mar 23, 2004 at 03:41 UTC ( #338880=note: print w/replies, xml ) Need Help??

in reply to Win32::Process and tee

The quotes are important because of what they do: Without them, the shell catches the pipe before the shell you're invoking (cmd.exe) even sees them.
Without quotes:
{ C:\Windows\System32\cmd.exe /c c:\test\slowproc.cmd } | tee.exe proc +esslog
with quotes (hopefully):
C:\Windows\System32\cmd.exe /c { " c:\test\slowproc.cmd | tee.exe proc +esslog " }
If you could get rid of the call to tee.exe, you could get rid of using cmd.exe too. Much as I dislike it when a monk rashly suggests the OP turn left after requesting help with turning right, here goes:

Instead of the cmd.exe/tee.exe adventure, have you considered using Perl's fork(), then in the child process: open CMD, "slowproc.cmd|";? You could then write anything you get on <CMD> to STDOUT and a log file. (OK, my Camel is at work, so I'm hoping that I did that right from memory. I will trust the other monks to gently correct if not.)

If you're not interested in going down the fork()'ed path, the other option would be to create a wrapper.cmd that invokes slowproc.cmd with the pipe. Then ask cmd.exe to run wrappers.cmd.

Hope this helps.

Spring: Forces, Coiled Again!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://338880]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2019-07-21 12:39 GMT
Find Nodes?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?

    Results (8 votes). Check out past polls.