Skip to content

Instantly share code, notes, and snippets.

@gr33n7007h
Last active November 6, 2019 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gr33n7007h/9c5cf969b64b15c288ee05b70f390ec6 to your computer and use it in GitHub Desktop.
Save gr33n7007h/9c5cf969b64b15c288ee05b70f390ec6 to your computer and use it in GitHub Desktop.
TracePoint
#!/usr/bin/env ruby
require 'open3'
TracePoint.trace(:call) do |tp|
if tp.method_id == :capture3
m = tp.self.method(tp.method_id)
m.parameters.each do |_, param|
puts "#{tp.method_id} called with #{tp.binding.local_variable_get(param)}"
end
end
end
Open3.capture3('ls -lhas')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment