Ruby Tracepoint - 将挂钩附加到open3子进程

时间:2015-12-07 14:04:09

标签: ruby

我正在使用伟大的Tracepoint API,我想知道是否可以将事件挂钩附加到我使用popen3启动的ruby进程?

一个例子:

TracePoint.trace(:end) do |e|
  # Here we do something like logging this event.
end


Open3.popen3(cmd) do |stdin, stdout, stderr, thread|
  # cmd is a ruby cmd, and we want the tracepoint above to apply to it as well
end

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

没有针对popen3的解决方案,但是一个简单的exec就可以了。