Class: LiquidProxy::Subprocess

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid-proxy/subprocess.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Subprocess

Returns a new instance of Subprocess.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/liquid-proxy/subprocess.rb', line 5

def initialize(opts = {})
  @child = ChildProcess.build(File.expand_path("../../../bin/liquid-proxy", __FILE__), opts[:port].to_s || "8998")
  @child.io.inherit!
  @child.start

  at_exit do
    # I don't know why, but without this puts() at_exit is triggered on Ctrl-C when running in spork
    # even though Subprocess has been started in prefork
    puts ''
    @child.stop
  end
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/liquid-proxy/subprocess.rb', line 18

def alive?
  @child.alive?
end