Method: Mccloud::Provider::Core::VmCommand#fg_exec

Defined in:
lib/mccloud/provider/core/vm/ssh.rb

#fg_exec(ssh_command, options) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mccloud/provider/core/vm/ssh.rb', line 61

def fg_exec(ssh_command,options)
  # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails
  # (GH-51). As a workaround, we fork and wait. On all other platforms,
  # we simply exec.
  pid = nil
  pid = fork if Mccloud::Util::Platform.leopard? || Mccloud::Util::Platform.tiger?

  env.logger.info "Executing internal ssh command"
  # Add terminal
  env.logger.info ssh_command+" -t"
  Kernel.exec ssh_command if pid.nil?
  Process.wait(pid) if pid
end