in reply to Re: Redirecting and using output from executed program
in thread Redirecting and using output from executed program

I don't want to redirect my own scripts STDERR anywhere (unless that is the only option, then obviously I must). I want to redirect/edit the STDERR from the program I execute. Every rediction must be done within script, as the script will be called by others programs eventually.
  • Comment on Re^2: Redirecting and using output from executed program

Replies are listed 'Best First'.
Re^3: Redirecting and using output from executed program
by tachyon (Chancellor) on Sep 30, 2004 at 08:13 UTC

    It is no different within yor script, just open (T_RES,"@exec 2>&1 |")

      Ah... Ok :). Then I will get both STDERR and STDOUT in same stream. Thats would work, thanks.

      However is it possible to get it into different stream or prepend each line from STDERR or STDOUT with something to allow easier seperation of the STDOUT and STDERR?

        Yes, see IPC::Open3

        use IPC::Open3; $pid = open3( \*WTRFH, \*RDRFH, \*ERRFH, 'some cmd and args' );