# File lib/queue.rb, line 206
    def run_qmail_queue(command=nil, &block)
      # Set up pipes and qmail-queue child process
      msg_read, msg_write = IO.pipe
      env_read, env_write = IO.pipe
      @child=fork # child? nil : childs_process_id

      unless @child 
        ## Set child's stdin(0) to read from msg
        $stdin.close # FD=0
        msg_read.dup
        msg_read.close
        msg_write.close

        ## Set child's stdout(1) to read from env
        $stdout.close # FD=1
        env_read.dup
        env_read.close
        env_write.close

        # Change directory and load command
        Dir.chdir(@options[:qmail_root])
        exec( command || @options[:qmail_queue] )
        raise "Exec qmail-queue failed"
      end

      # Parent Process with block
      if block_given?
        yield(msg_write, env_write)
      # msg_write.close
        env_write.close
        wait(@child)
        @success = $? >> 8
        # puts "#{$$} parent waited for #{@child} s=#{@success} #{$?.inspect}"
        return @sucess
      end
      
      # Parent process, no block
      {:msg=>msg_write, :env=>env_write, :pid=>@child}
    end