def process_callback(id, command, code, stdout, stderr)
      code = case code
             when Weechat::WEECHAT_HOOK_PROCESS_RUNNING
               :running
             when Weechat::WEECHAT_HOOK_PROCESS_ERROR
               :error
             else
               code
             end

      process = Weechat::Process.find_by_id(id)
      if process.collect?
        process.buffer(stdout, stderr)
        if code == :error || code != :running
          process.call(code, process.stdout, process.stderr)
        end
      else
        process.call(code, stdout, stderr)
      end
    end
def process_callback(id, command, code, stdout, stderr)
      code = case code
             when Weechat::WEECHAT_HOOK_PROCESS_RUNNING
               :running
             when Weechat::WEECHAT_HOOK_PROCESS_ERROR
               :error
             else
               code
             end

      process = Weechat::Process.find_by_id(id)
      if process.collect?
        process.buffer(stdout, stderr)
        if code == :error || code != :running
          process.call(code, process.stdout, process.stderr)
        end
      else
        process.call(code, stdout, stderr)
      end
    end
low level process callback