This class is the concrete representation of an abstract job.
Creates an individual job instance and initializes it with the supplied parameters.
# File lib/rex/job_container.rb, line 14 def initialize(container, jid, name, ctx, run_proc, clean_proc) self.container = container self.jid = jid self.name = name self.run_proc = run_proc self.clean_proc = clean_proc self.ctx = ctx self.start_time = nil end
Runs the job in the context of its own thread if the async flag is false. Otherwise, the job is run inline.
# File lib/rex/job_container.rb, line 28 def start(async = false) self.start_time = Time.now if (async) self.job_thread = Rex::ThreadFactory.spawn("JobID(#{jid})-#{name}", false) { # Deschedule our thread momentarily ::IO.select(nil, nil, nil, 0.01) begin run_proc.call(ctx) ensure clean_proc.call(ctx) container.remove_job(self) end } else begin run_proc.call(ctx) rescue ::Exception container.stop_job(jid) raise $! end end end
Generated with the Darkfish Rdoc Generator 2.