Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Win32::Process and tee

by paulbort (Hermit)
on Mar 23, 2004 at 03:41 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2025-06-16 06:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.