class Proclib::Commands::Local

Public Instance Methods

spawn() click to toggle source
# File lib/proclib/commands/local.rb, line 7
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

  unless stdin.nil?
    until stdin.eof?
      pipes.stdin.write(stdin.read(STDIN_BUF_SIZE))
    end

    stdin.close
  end

  pipes.stdin.close
end
wait() click to toggle source
# File lib/proclib/commands/local.rb, line 29
def wait
  @result ||= wait_thread.value.to_i
end

Private Instance Methods

wait_thread() click to toggle source
# File lib/proclib/commands/local.rb, line 35
def wait_thread
  @wait_thread || raise(NotYetRunning)
end