<?xml version="1.0" encoding="windows-1252"?>
<node id="275134" title="Re: Re: Re: Re^4: Use of IPC::Run rather than system()" created="2003-07-17 03:18:47" updated="2005-06-08 19:45:11">
<type id="11">
note</type>
<author id="127307">
IlyaM</author>
<data>
<field name="doctext">
&lt;p&gt;I'm not sure it is correct syntax. From [IPC::Run] docs:&lt;/p&gt;

&lt;code&gt;
       '&gt;pty&gt;' means '&amp;&gt;pty&gt;', not '1&gt;pty&gt;'
           The pseudo terminal redirects both stdout and stderr
           unless you specify a file descriptor.  If you want to
           grab stderr separately, do this:

              start \@cmd, '&lt;pty&lt;', \$in, '&gt;pty&gt;', \$out, '2&gt;', \$err ;
&lt;/code&gt;

&lt;p&gt;So probably your code should look like (untested):&lt;/p&gt;
&lt;code&gt;
use IPC::Run qw(run);

my ($out, $err);

run (
    [ '/usr/sbin/pkgrm', 'VRTSvxvm' ],
    '&gt;pty&gt;', sub { $out .= $_[0]; print STDOUT $_[0] },
    '2&gt;', sub { $err .= $_[0]; print STDERR $_[0] },
    );
&lt;/code&gt;

&lt;p&gt;
&lt;font color="grey" size="-2"&gt;
--&lt;br&gt;
Ilya Martynov,  &lt;a href="mailto:ilya@iponweb.net"&gt;ilya@iponweb.net&lt;/a&gt;&lt;br&gt;
CTO IPonWEB (UK) Ltd&lt;br&gt;
Quality Perl Programming and Unix Support
UK managed @ offshore prices - &lt;a href="http://www.iponweb.net"&gt;http://www.iponweb.net&lt;/a&gt;&lt;br&gt;
Personal website - &lt;a href="http://martynov.org/"&gt;http://martynov.org&lt;/a&gt;&lt;br&gt;
&lt;/font&gt;</field>
<field name="root_node">
274875</field>
<field name="parent_node">
275086</field>
</data>
</node>
