Sha256: 93a4e5ac3378eff912af419d9a5987aa059f7d7035fe7e0e0cc68b349042e83b

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

module SimpleWorker
  class LocalWorker < AbstractListener

    DEFAULT_CMD = ['/bin/bash', '-l', 'bundle', 'exec', 'rake']

    def initialize(*args)
      cmd = args
      cmd = DEFAULT_CMD if cmd.empty?
      @process = ChildProcess.build(*cmd)
      @process.io.inherit!
    end

    # Start a subprocess with the environment variable 'JOBID' set to the current jobid.
    #
    def on_start(jobid)
      @process.environment['JOBID'] = jobid
      @process.start
    end

    def on_stop
      @process.stop
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simpleworker-0.1.1 lib/simpleworker/local_worker.rb
simpleworker-0.1.0 lib/simpleworker/local_worker.rb