check
is not recommended. 46 """
47
48 def run_command(command_array):
49 completed_command = subprocess.run( 50 command_array, stdout=subprocess.PIPE, stderr=subprocess.PIPE
51 )
52 output = completed_command.stdout.decode("utf-8")
subprocess.run
uses a default of check=False
, which means that a nonzero exit code will be
ignored by default, instead of raising an exception.
You can ignore this issue if this behaviour is intended.
# Nonzero exit code will be ignored here
subprocess.run(['notify-send', '-u', 'critical', msg])
# Exception will be raised for nonzero exit code
subprocess.run(['notify-send', '-u', 'critical', msg], check=True) # some comment