From 85acee52afc5e4d74d45fb501a5c41e83b1b6bc1 Mon Sep 17 00:00:00 2001 From: Kevin Alberts Date: Sat, 25 Apr 2020 03:04:00 +0200 Subject: [PATCH] Split command output --- lsof_spy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lsof_spy.py b/lsof_spy.py index df7a7e9..e55e327 100644 --- a/lsof_spy.py +++ b/lsof_spy.py @@ -40,7 +40,7 @@ smb_active = 0 smb_files = 0 try: - smbd_output = subprocess.check_output([SUDO, "lsof", "-c", "/^"+SMBD+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode() + smbd_output = subprocess.check_output([SUDO, "lsof", "-c", "/^"+SMBD+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode().split() except subprocess.CalledProcessError as e: # Error running process. pass @@ -132,7 +132,7 @@ http_users = 0 http_files = 0 try: - http_output = subprocess.check_output([SUDO, "lsof", "-c", "/^"+APACHE+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode() + http_output = subprocess.check_output([SUDO, "lsof", "-c", "/^"+APACHE+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode().split() except subprocess.CalledProcessError as e: # Error running process. pass