diff --git a/common/command.py b/common/command.py index df6e21a2b10884741bba7321bb6aa6fd61ebc129..2abbe6fd25541ba9d59f9af7b86cf38197d18ec7 100644 --- a/common/command.py +++ b/common/command.py @@ -16,8 +16,9 @@ class Command: ''' Encapsulated CALL function to return abnormal location information ''' - if(subprocess.call(cmd, shell = True)): - raise Exception("{} : [{}] Failed to execute!".format(caller, cmd)) + result = subprocess.run(cmd, shell=True, capture_output=True, text=True) + if result.returncode != 0: + raise Exception("{} : [{}] Failed to execute! Output: {}".format(caller, cmd, result.stderr)) @staticmethod def check_ethtool_cg(cmd_stde):