blob: 91a42b232b435b5661639009f553c6e9a6ec250b [file] [log] [blame]
import subprocess
def execute_cmd(parms_string, quiet=False):
r"""
Run CLI standard tool or scripts.
Description of variable:
parms_string Command to execute from the current SHELL.
quiet do not print tool error message if True
"""
result = subprocess.run(
[parms_string],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
universal_newlines=True,
)
if result.stderr and not quiet:
print("\n\t\tERROR with %s " % parms_string)
print("\t\t" + result.stderr)
return result.stdout