flush the file every line

This commit is contained in:
JerryXiao 2019-04-09 23:02:48 +08:00
parent cbec64fb3c
commit 84f8afd8a0
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA

View file

@ -79,6 +79,7 @@ def run_cmd(cmd, cwd=None, keepalive=False, KEEPALIVE_TIMEOUT=30, RUN_CMD_TIMEOU
super().append(mystring) super().append(mystring)
if self.__file and type(mystring) is str: if self.__file and type(mystring) is str:
self.__file.write(mystring) self.__file.write(mystring)
self.__file.flush()
def __enter__(self): def __enter__(self):
return self return self
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):