Commit 52d8825d authored by liuzheng712's avatar liuzheng712

修复tmux等会重复出现命令的bug

parent e743ae3d
...@@ -174,13 +174,12 @@ class TermLogRecorder(object): ...@@ -174,13 +174,12 @@ class TermLogRecorder(object):
self._stream.attach(self._screen) self._stream.attach(self._screen)
def _command(self): def _command(self):
self._commands = []
for i in self._screen.display: for i in self._screen.display:
if i.strip().__len__() > 0: if i.strip().__len__() > 0:
self._commands.append(i.strip()) self._commands.append(i.strip())
if not i.strip() == '':
self.CMD[str(time.time())] = self._commands[-1]
self._screen.reset() self._screen.reset()
if not self._commands[-1] == '':
self.CMD[str(time.time())] = self._commands[-1]
def write(self, msg): def write(self, msg):
if self.recoder and (not self._in_vim): if self.recoder and (not self._in_vim):
...@@ -199,6 +198,10 @@ class TermLogRecorder(object): ...@@ -199,6 +198,10 @@ class TermLogRecorder(object):
self._screen.reset() self._screen.reset()
else: else:
self._command() self._command()
print "<<<<<<<<<<<<<<<<"
print self._commands
print self.CMD
print ">>>>>>>>>>>>>>>>"
self.log[str(time.time() - self.recoderStartTime)] = msg.decode('utf-8', 'replace') self.log[str(time.time() - self.recoderStartTime)] = msg.decode('utf-8', 'replace')
def show(self): def show(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment