(command, start_dir = PROJECT_SRC_DIR, env=None, verbose=False)
| 42 | # Runs a command in a directory and returns its return code. |
| 43 | # Directory is project root by default, or a relative path from project root |
| 44 | def RunShellCmd(command, start_dir = PROJECT_SRC_DIR, env=None, verbose=False): |
| 45 | # Flush stdout here. Helps when debugging on CI. |
| 46 | sys.stdout.flush() |
| 47 | |
| 48 | if start_dir != PROJECT_SRC_DIR: |
| 49 | start_dir = repo_relative(start_dir) |
| 50 | cmd_list = command.split(" ") |
| 51 | |
| 52 | # Helps a lot when debugging CI issues |
| 53 | if IsGHA(): |
| 54 | verbose = True |
| 55 | |
| 56 | if verbose: |
| 57 | print(f'CICMD({cmd_list}, env={env})') |
| 58 | subprocess.check_call(cmd_list, cwd=start_dir, env=env) |
nothing calls this directly
no test coverage detected