Class: Proclib::Commands::Local
- Inherits:
-
Base
- Object
- Base
- Proclib::Commands::Local
show all
- Defined in:
- lib/proclib/commands/local.rb
Constant Summary
Constants inherited
from Base
Base::NotYetRunning, Base::NotYetTerminated, Base::STDIN_BUF_SIZE
Instance Method Summary
collapse
Instance Method Details
#spawn ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# 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 ⇒ Object
29
30
31
|
# File 'lib/proclib/commands/local.rb', line 29
def wait
@result ||= wait_thread.value.to_i
end
|