From 3d71ce1dbc9acf7d39fe74bda3eb3ed09b9ddede Mon Sep 17 00:00:00 2001 From: macos <tengyue.li@100credit.com> Date: Wed, 27 May 2020 18:44:19 +0800 Subject: [PATCH] fix --- clients/client-psutil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/client-psutil.py b/clients/client-psutil.py index fe1632c..bc8995a 100755 --- a/clients/client-psutil.py +++ b/clients/client-psutil.py @@ -78,12 +78,12 @@ def tupd(): :return: ''' try: - if 'linux' in sys.platform: + if sys.platform.startswith("linux") is True: t = int(os.popen('ss -t|wc -l').read()[:-1])-1 u = int(os.popen('ss -u|wc -l').read()[:-1])-1 p = int(os.popen('ps -ef|wc -l').read()[:-1])-2 d = int(os.popen('ps -eLf|wc -l').read()[:-1])-2 - elif 'win' in sys.platform: + elif sys.platform.startswith("win") is True: t = int(os.popen('netstat -an|find "TCP" /c').read()[:-1])-1 u = int(os.popen('netstat -an|find "UDP" /c').read()[:-1])-1 p = len(psutil.pids())