NYCPHP Meetup

NYPHP.org

[nycphp-talk] exec() funciton help

Dan Cech dcech at phpwerx.net
Sat Aug 5 15:42:56 EDT 2006


Dan Cech wrote:
> secondly, redirect stderr from the svn log command to stdout so that you
> can see any errors it outputs and react to them:
> 
> 1. use 1>&3 to 'save' stdout
> 2. redirect stdout to the output file with 1>filename
> 3. redirect stderr to the 'saved' stdout with 2>&3
> 
> Here is some example code:
> 
>   exec('/usr/bin/svn log -v 1>&3 1>'.$file.' 2>&3',$output,$retval);

I just realised there is a much simpler way to achieve this:

exec('/usr/bin/svn log -v 2>&1 1>'.$file,$output,$retval);

Dan



More information about the talk mailing list