Class: Proclib::Commands::LocalCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/proclib/command.rb

Constant Summary

Constants inherited from Command

Command::NotYetRunning, Command::NotYetTerminated

Instance Method Summary collapse

Instance Method Details

#spawnObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/proclib/command.rb', line 42

def spawn
  spawn = -> do
    pipes.stdin, pipes.stdout, pipes.stderr, @wait_thread = Open3.popen3(env, cmdline)
  end

  if run_dir
    Dir.chdir(run_dir) { spawn.call }
  else
    spawn.call
  end
end

#waitObject



54
55
56
# File 'lib/proclib/command.rb', line 54

def wait
  @result ||= wait_thread.value.to_i
end