19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/pytty/client/cli/run_command.rb', line 19
def execute
Async.run do |task|
response, body = Pytty::Client::Api::Yield.run id: name, cmd: cmd_list, env: {}
unless response.status == 200
puts body
exit 1
end
process_yield = Pytty::Client::ProcessYield.from_json body
attach_task = unless detach?
task.async do
process_yield.attach interactive: interactive?
process_yield.rm
end
end
response, body = process_yield.spawn tty: tty?, interactive: interactive?
if response.status == 200
if detach?
puts process_yield.id
end
else
puts body
attach_task.stop
print "\r" unless detach?
end
end
end
|