blob: 817dc1e30f0ac94aebde57c94f4dcb4a72834b46 [file] [log] [blame]
George Keishinge7a88fd2021-08-01 06:54:56 -05001import subprocess
2
3
4def execute_cmd(parms_string, quiet=False):
5 r"""
6 Run CLI standard tool or scripts.
7
8 Description of variable:
9 parms_string Command to execute from the current SHELL.
10 quiet do not print tool error message if True
11 """
12
13 result = subprocess.run([parms_string],
14 stdout=subprocess.PIPE,
15 stderr=subprocess.PIPE,
16 shell=True,
17 universal_newlines=True)
18
19 if result.stderr and not quiet:
20 print('\n\t\tERROR with %s ' % parms_string)
21 print('\t\t' + result.stderr)
22
23 return result.stdout