# File lib/rq-2.3.1/jobrunner.rb, line 27
      def initialize job
#--{{{
        @job = job
        @jid = job['jid']
        @command = job['command']
        @shell = job['shell'] || 'bash'
        @r,@w = IO::pipe
        @env = {}
        @job.fields.each do |field|
          key = "RQ_#{ field }".upcase.gsub(%/\s+/,'_')
          val = @job[field]
          @env[key] = "#{ val }"
        end
        @env['RQ_JOB'] = @job.to_hash.to_yaml 
        @cid = 
          Util::fork do
            begin
              @env.each{|k,v| ENV[k] = v}
              ENV['RQ_PID'] = "#{ $$ }"
              @w.close
              STDIN.reopen @r
              if File::basename(@shell) == 'bash' || File::basename(@shell) == 'sh' 
                exec [@shell, "__rq_job__#{ @jid }__#{ File::basename(@shell) }__"], '--login'
              else
                exec [@shell, "__rq_job__#{ @jid }__#{ File::basename(@shell) }__"], '-l'
              end
            rescue Exception => e
              STDERR.puts(Util::errmsg(e))
            end
          end
        @r.close
#--}}}
      end