def run(self):

        try:
            in_file = open(self.input_capture_file_path, 'rb')
        except IOError, e:
            debug("Cannot open capture file: %s") % unicode(e)
            self.exit()
            return
        try:
            self.process = subprocess.Popen(self.capture_cmd.strip())
        except (OSError, IOError), e:
            debug("Cannot start Wireshark: %s") % unicode(e)
            self.exit()
            return
        try:
            self.pipe = win32pipe.CreateNamedPipe(self.wireshark_pipe, win32pipe.PIPE_ACCESS_OUTBOUND, win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_WAIT, 1, 65536, 65536, 300, None)
            win32pipe.ConnectNamedPipe(self.pipe, None)
        except win32pipe.error:
            debug("Error while creating and connecting the pipe ...")
            win32file.CloseHandle(self.pipe)
            self.exit()
            return

        while True:
            data = in_file.read()
            if not self.process or self.process.returncode != None:
                win32file.CloseHandle(self.pipe)
                debug("Wireshark is not running, deleting pipe ...")
                self.exit()
                return
            if data:
                try:
                    win32file.WriteFile(self.pipe, data)
                except:
                    win32file.CloseHandle(self.pipe)
                    debug("Wireshark has been closed, deleting pipe ...")
                    self.exit()
                    return
            else:
                time.sleep(0.5) #FIXME: find a better way to wake-up the thread only when there is data to read