5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/wocker/vagrant.rb', line 5
def self.run(*args)
stderr_reader, stderr_writer = IO.pipe
stdout,stdin,pid = PTY.spawn("vagrant", *args, err: stderr_writer.fileno)
stderr_writer.close
stdin_thr = Thread.new do
stdin.close
end
stdout_thr = Thread.new do
while line = stdout.gets
print line
end
end
stderr_thr = Thread.new do
while line = stderr_reader.gets
print line
end
end
stdin_thr.join
stdout_thr.join
stderr_thr.join
end
|