(command, is_shell=False, cwd='.', suppress_errors=False)
| 3 | |
| 4 | |
| 5 | def 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 | |
| 24 | def copy_dir(src, dest, with_sudo=False): |
no outgoing calls
no test coverage detected