Class: Pytty::Client::Cli::RunCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/pytty/client/cli/run_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pytty/client/cli/run_command.rb', line 17

def execute
  Async.run do |task|
    json = Pytty::Client::Api::Yield.run id: name, cmd: cmd_list, env: {}
    process_yield = Pytty::Client::ProcessYield.from_json json
    unless detach?
      task.async do
        process_yield.attach interactive: interactive?
      end
    end

    process_yield.spawn tty: tty?, interactive: interactive?

    if detach?
      puts process_yield.id
    end
  end
end