Class: SSHKit::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/background/command.rb

Instance Method Summary collapse

Instance Method Details

#in_background(&_block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/capistrano/background/command.rb', line 5

def in_background(&_block)
  return yield unless options[:run_in_background]
  pid_file = options[:pid_file]
  if pid_file.nil?
    orig_in_background(&_block)
  else
    env_str = environment_string
    if env_str.nil?
      sprintf("( nohup %s > /dev/null & \\echo $! > #{pid_file})", yield)
    else
      sprintf(" && ( #{env_str} nohup %s > /dev/null & \\echo $! > #{pid_file})", yield)
    end
  end
end

#orig_in_backgroundObject



3
# File 'lib/capistrano/background/command.rb', line 3

alias_method :orig_in_background, :in_background