MCPcopy Create free account
hub / github.com/clintmod/macprefs / execute_shell

Function execute_shell

utils.py:5–21  ·  view source on GitHub ↗
(command, is_shell=False, cwd='.', suppress_errors=False)

Source from the content-addressed store, hash-verified

3
4
5def execute_shell(command, is_shell=False, cwd='.', suppress_errors=False):
6 output = ''
7 log.debug('\n--- executing shell command ----\n')
8 log.debug('setting working dir to: ' + cwd)
9 log.debug('command: ' + str(command))
10 try:
11 output = check_output(command, shell=is_shell,
12 cwd=cwd, stderr=STDOUT).strip().decode("utf-8")
13 log.debug('output = ' + output)
14 except CalledProcessError as err:
15 log.error('Error Info:\nerror code = %s\ncmd %s\nerror message:%s',
16 err.returncode, err.cmd, err.output)
17 if not suppress_errors:
18 raise
19 finally:
20 log.debug('\n---- shell execution finished ---\n')
21 return output
22
23
24def copy_dir(src, dest, with_sudo=False):

Callers 15

calc_sha256Function · 0.90
upload_new_brew_formulaFunction · 0.90
download_macprefsFunction · 0.90
verify_macprefsFunction · 0.90
build_file_listFunction · 0.90
copy_dirFunction · 0.85
copy_filesFunction · 0.85
copy_fileFunction · 0.85
change_owner_for_filesFunction · 0.85
change_mode_for_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected