in reply to Calling strace from a perl program

Another thing to try, instead of trying to capture the strace output in a filehandle, is to use the -o option to set a file for it to output to. It will probably work better. That way you can fork off the "system strace -o $pid_out -p $pid", and it shouldn't block.

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: Calling strace from a perl program
by jason_s (Acolyte) on Mar 11, 2008 at 23:51 UTC
    Thanks! I did get it to work this way. I just forked, had strace write to a file with the "-o" option, had the parent sleep a second, then send the child a SIGALRM. I then processed the strace output file in a second step. I actually found that using strace isn't the best way to find processes blocking in flock -- but I've been wanting to do other things with strace from Perl, so this will be good for future use.