Sha256: 0baecb8972ea0d3b2d483bb094fd63a1d390240a916aee624af7f707d9c870a6

Contents?: true

Size: 727 Bytes

Versions: 3

Compression:

Stored size: 727 Bytes

Contents

#!/usr/bin/env ruby1.9

require "base64"
require "#{File.dirname(__FILE__)}/../lib/ruby_process.rb"

$stdin.sync = true
$stdout.sync = true
$stderr.sync = true

debug = false
pid = nil

ARGV.each do |arg|
  if arg == "--debug"
    debug = true
  elsif match = arg.match(/--pid=(\d+)$/)
    pid = match[1].to_i
  elsif match = arg.match(/--title=(.+)$/)
    #ignore - its for finding process via 'ps aux'.
  else
    raise "Unknown argument: '#{arg}'."
  end
end

debug = true if ARGV.index("--debug") != nil
raise "No PID given of parent process." if !pid

rps = Ruby_process.new(
  :in => $stdin,
  :out => $stdout,
  :err => $stderr,
  :debug => debug,
  :pid => pid
)
rps.listen
$stdout.puts("ruby_process_started")
rps.join

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_process-0.0.9 scripts/ruby_process_script.rb
ruby_process-0.0.8 scripts/ruby_process_script.rb
ruby_process-0.0.7 scripts/ruby_process_script.rb