mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge pull request #264 from aspiers/ssh-forward-logging
fix redirection of STDOUT/ERR of ssh port forwarding process (#226)
This commit is contained in:
@@ -118,7 +118,20 @@ module VagrantPlugins
|
||||
ssh_cmd << "ssh #{options} #{params}"
|
||||
|
||||
@logger.debug "Forwarding port with `#{ssh_cmd}`"
|
||||
spawn(ssh_cmd, [:out, :err] => '/dev/null')
|
||||
log_file = ssh_forward_log_file(host_ip, host_port,
|
||||
guest_ip, guest_port)
|
||||
@logger.info "Logging to #{log_file}"
|
||||
spawn(ssh_cmd, [:out, :err] => [log_file, 'w'])
|
||||
end
|
||||
|
||||
def ssh_forward_log_file(host_ip, host_port, guest_ip, guest_port)
|
||||
log_dir = @env[:machine].data_dir.join('logs')
|
||||
log_dir.mkdir unless log_dir.directory?
|
||||
File.join(
|
||||
log_dir,
|
||||
'ssh-forwarding-%s_%s-%s_%s.log' %
|
||||
[ host_ip, host_port, guest_ip, guest_port ]
|
||||
)
|
||||
end
|
||||
|
||||
def store_ssh_pid(host_port, ssh_pid)
|
||||
|
||||
Reference in New Issue
Block a user