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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pytty/client/cli/run_command.rb', line 12

def execute
  Async.run do
    internet = Async::HTTP::Internet.new
    headers = [['accept', 'application/json']]
    body = {
      cmd: cmd_list
    }.to_json

    response = internet.post("http://localhost:1234/v1/run", headers, [body])
    puts response.read
  ensure
    internet.close
  end
end