From e6cdee50d89dcdda11937c5b14b6eb947490f5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=B0=E6=96=87?= <1635370493@qq.com> Date: Wed, 31 Jan 2024 20:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E5=8A=9F=E4=B8=94=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E5=9C=B0=E9=80=90=E8=A1=8C=E8=AF=BB=E5=8F=96=E6=AD=A3=E5=9C=A8?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=9A=84=E7=A8=8B=E5=BA=8F=E7=9A=84=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E3=80=82=E5=B7=B2=E6=B5=8B=E8=AF=95=EF=BC=8C=E5=B7=B2?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E5=8F=AF=E4=BB=A5=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=BD=86=E6=97=A0=E6=B3=95=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E4=B8=AA=EF=BC=8C=E5=90=AF=E5=8A=A8=E5=99=A8?= =?UTF-8?q?=E6=9C=AC=E8=BA=AB=E7=9A=84=E9=99=90=E5=88=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ src/CBJQ_SS_FrontEnd_tk/main.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 959bb91..d8883ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ venv keep_local +.idea +__pycache__ diff --git a/src/CBJQ_SS_FrontEnd_tk/main.py b/src/CBJQ_SS_FrontEnd_tk/main.py index 564201d..4890cff 100644 --- a/src/CBJQ_SS_FrontEnd_tk/main.py +++ b/src/CBJQ_SS_FrontEnd_tk/main.py @@ -220,17 +220,21 @@ def execAction(self, **kwargs): with subprocess.Popen(launch_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8') as sp: self.displayLog_text.insertAndScrollToEnd(f'sp.pid: {sp.pid}') self.displayLog_text.insertAndScrollToEnd('[+]' + '运行报告' + '-' * 15) - while sp.poll() is None: + while True: # print('to read') # output = sp.communicate(timeout=1)[0] - output = sp.stdout.readline() + try: + output = sp.stdout.__next__() + except StopIteration: + break + # output = sp.stdout.readline() # print(f'[stdout]: {i}', end='') # self.displayLog_text.insert('end', i) # self.displayLog_text.yview_moveto(1) self.displayLog_text.insertAndScrollToEnd(output, end='') # instance method # self.displayLog_text.update() print('') - self.displayLog_text.insertAndScrollToEnd('[-]' + '运行后报告' + '-' * 15) + self.displayLog_text.insertAndScrollToEnd('[-]' + f'运行后报告(pid: {sp.pid})' + '-' * 15) self.displayLog_text.insertAndScrollToEnd('[-]' + '' + '=' * 15) pass