Skip to content

Instantly share code, notes, and snippets.

@eam
Created November 4, 2015 20:07
Show Gist options
  • Select an option

  • Save eam/32ec11669463e143f743 to your computer and use it in GitHub Desktop.

Select an option

Save eam/32ec11669463e143f743 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
pattern = ARGV.shift
pids = %x{pgrep "#{pattern}"}.split.reject {|p| Integer(p); p.to_i == $$ or p.to_i == $?.pid }
pidargs = (["-p"] * pids.size).zip(pids).flatten
raise "no pids match" if pidargs.empty?
exec "strace", *ARGV, *pidargs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment