Sha256: bf38c4130cc73a4dc3a5bbcabeea7b78cb6386fd92ff3f60b8303ebeb1bc7106
Contents?: true
Size: 936 Bytes
Versions: 2
Compression:
Stored size: 936 Bytes
Contents
# frozen_string_literal: true module Pytty module Daemon module Components module Handler def self.handle(component:, params:) return case component when "ps" output = [] Pytty::Daemon.yields.each do |id, process_yield| output << process_yield end [200, output] when "yield" cmd = params.dig "cmd" env = params.dig "env" id = params.dig "id" if Pytty::Daemon.yields[id] [500, "already exists"] else process_yield = Pytty::Daemon::ProcessYield.new cmd, id: id, env: env Pytty::Daemon.yields[process_yield.id] = process_yield Pytty::Daemon.dump [200, process_yield] end else raise "unknown: #{component}" end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pytty-0.5.0 | lib/pytty/daemon/components/handler.rb |
pytty-0.4.1 | lib/pytty/daemon/components/handler.rb |