Method: Rundoc::CodeCommand::Background::Start#initialize

Defined in:
lib/rundoc/code_command/background/start.rb

#initialize(command, name:, wait: nil, timeout: 5, log: Tempfile.new("log"), out: "2>&1", allow_fail: false) ⇒ Start

Returns a new instance of Start.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rundoc/code_command/background/start.rb', line 5

def initialize(command, name:, wait: nil, timeout: 5, log: Tempfile.new("log"), out: "2>&1", allow_fail: false)
  @command = command
  @name = name
  @wait = wait
  @allow_fail = allow_fail
  FileUtils.touch(log)

  @spawn = ProcessSpawn.new(
    @command,
    timeout: timeout,
    log: log,
    out: out
  )
  puts "Spawning commmand: `#{@spawn.command}`"
  ProcessSpawn.add(@name, @spawn)
end