Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 27 lines (23 sloc) 888 Bytes
#!/usr/bin/env ruby
require 'optparse'
require File.dirname(__FILE__) + '/../lib/hijack'
require 'hijack'
options = {}
usage = 'Usage: hijack [options] <PID>'
pid = ARGV.find {|o| o =~ /\d/}
new_argv = ARGV.clone
new_argv.options do |opts|
opts.banner = usage
opts.on("--debug", "Enable debugging.") { |v| options[:debug] = true }
opts.on("--mute", "Ignore stdout/stderr writes from the remote process.") { |v| options[:mute] = true }
opts.on("-e", "--execute=FILE", String, "Execute the specified file in the remote process and then disconnect.") { |v| options[:execute] = v }
opts.on("--version", "Display this version of Hijack.") { |v| puts "Hijack #{Hijack.version}"; exit }
opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
if pid.nil? || pid.to_s == ''
puts usage
exit 1
Hijack.start(pid, options)
Jump to Line
Something went wrong with that request. Please try again.