Sha256: 0547f4b0a043eabb2806353218a2266a9c46bfd1bf5cc3fc23c4306c796d8527

Contents?: true

Size: 521 Bytes

Versions: 3

Compression:

Stored size: 521 Bytes

Contents

$:.push(File.join(File.dirname(__FILE__), "..", "..", "lib"))
require "marilyn-rpc"
require "rubygems"
require "eventmachine"

class SimpleCommandService < MarilynRPC::Service
  register :cmd
  
  def exec(line)
    MarilynRPC::Gentleman.proxy do |helper|
      EM.system(line, &helper)
    
      lambda do |output,status|
        if (code = status.exitstatus) == 0
          output 
        else
          code
        end
      end
    end
  end
end

EM.run {
  EM.start_server "localhost", 8000, MarilynRPC::Server
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marilyn-rpc-0.0.4 examples/async/server.rb
marilyn-rpc-0.0.3 examples/async/server.rb
marilyn-rpc-0.0.2 examples/async/server.rb