-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkcachegrind.rb
35 lines (25 loc) · 1.07 KB
/
kcachegrind.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class KcachegrindCommand < Vagrant::Command::Base
def execute
options = {}
opts = OptionParser.new do |opt|
opt.banner = "Usage: vagrant kcachegrind [vm-name]"
opt.on('--verbose') do |v|
options[:verbose] = true
end
end
argv = parse_options(opts)
unless argv
argv=["default"]
end
with_target_vms(argv) do |vm|
puts "kcachegrind is starting, this might take a moment"
ssh_info = vm.ssh.info
ssh_options = "-p#{ssh_info[:port]} -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -oPasswordAuthentication=no -oIdentitiesOnly=yes -i#{ssh_info[:private_key_path]}"
ssh_host = "#{ssh_info[:username]}@#{ssh_info[:host]}"
command = 'ssh -X %s %s "/usr/bin/kcachegrind"&' % [ssh_options, ssh_host]
puts command if options[:verbose]
Vagrant::Util::Subprocess.execute(command)
end
end
end
Vagrant.commands.register(:kcachegrind) { KcachegrindCommand }