Sha256: 71a563dbf18a657fa9a7b223ca88422df5409e1578121e907062a66fb4b3465b

Contents?: true

Size: 305 Bytes

Versions: 12

Compression:

Stored size: 305 Bytes

Contents

module Nasty
  class BackgroundJob
    def initialize(process)
      @process = process
    end

    def run
      @pid = fork do
        exec @process
      end
    end

    def stop(signal = "TERM")
      if @pid
        Process.kill(signal, @pid)
        Process.wait(@pid)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nasty-0.0.1395464273 lib/nasty/background_job.rb
nasty-0.0.1388168019 lib/nasty/background_job.rb
nasty-0.0.1388167257 lib/nasty/background_job.rb
nasty-0.0.1388166944 lib/nasty/background_job.rb
nasty-0.0.1388166636 lib/nasty/background_job.rb
nasty-0.0.1388165564 lib/nasty/background_job.rb
nasty-0.0.1388164945 lib/nasty/background_job.rb
nasty-0.0.1388164765 lib/nasty/background_job.rb
nasty-0.0.1388163823 lib/nasty/background_job.rb
nasty-0.0.1388163382 lib/nasty/background_job.rb
nasty-0.0.1388163140 lib/nasty/background_job.rb
nasty-0.0.1388162472 lib/nasty/background_job.rb