Hi all,
I'm working on a script where dtrace attaches to (or spawns) a process
and the resulting dtrace output gets piped through a bunch of
post-processing when the user hits ^C. So far this is what I have (in bash)
exec 3> >(<insert-pipeline-here>)
dtrace [args] >&3
The exec+process substitution makes it so only dtrace notices the ^C
(otherwise post-processing gets killed along with the script).
Everything works beautifully when attaching to an existing process.
Unfortunately, when dtrace spawns the process to be traced the above
setup sends the process' output through the post-processing instead of
to stdout. The -o option for dtrace seemed ideal...
exec 3> >(<insert-pipeline-here>)
dtrace [args] -o >(cat >&3)
... but fails with
dtrace: failed to open output file '/dev/fd/63': Illegal seek
I imagine dtrace tried to truncate the output file... wouldn't it be
better to skip truncation for non-seekable files?
Meanwhile, is there a workaround? I need the program's output to go to
one stream and dtrace's to another because the script is called by other
scripts and there's lots of redirection and pipelining going on.
Even without the externally imposed pain, managing and cleaning up tmp
files is a pain because ^C makes the script exit in addition to dtrace
(so no cleanup commands would be executed, and post-processing would
have to be manually triggered after the fact).
Thanks,
Ryan
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org