in reply to Calling strace from a perl program

I can't test this right now, but I suspect you are being misled by buffering. I recall that strace writes to STDERR, which is normally non-buffered. However you are redirecting it to STDOUT (which you have to do to use the pipe) which is buffered. $|=1;before the open is worth a try.

Replies are listed 'Best First'.
Re^2: Calling strace from a perl program
by ikegami (Patriarch) on Mar 11, 2008 at 21:56 UTC

    For starters, $|=1; in the Perl program won't affect any buffering strace might do on its output. The pipe to which strace writes a completely independent file handle from the terminal (or whatever) the Perl script writes to. Furthermore, a variable in one process won't affect a library in a different process.

    Secondly, if strace doesn't buffer what it sends to its STDERR, the output is not going to magically buffer itself if redirected.

    Unfortunately, there's no way to control whether another application buffers its output or not (unless it specifically gives you the means of doing so, of course).