(command, start_dir = PROJECT_SRC_DIR, env=None, verbose=False)
| 98 | # Runs a command in a directory and returns its return code. |
| 99 | # Directory is project root by default, or a relative path from project root |
| 100 | def RunShellCmd(command, start_dir = PROJECT_SRC_DIR, env=None, verbose=False): |
| 101 | # Flush stdout here. Helps when debugging on CI. |
| 102 | sys.stdout.flush() |
| 103 | |
| 104 | if start_dir != PROJECT_SRC_DIR: |
| 105 | start_dir = RepoRelative(start_dir) |
| 106 | cmd_list = command.split(" ") |
| 107 | |
| 108 | # Helps a lot when debugging CI issues |
| 109 | if IsGHA(): |
| 110 | verbose = True |
| 111 | |
| 112 | if verbose: |
| 113 | print(f'CICMD({cmd_list}, env={env})') |
| 114 | subprocess.check_call(cmd_list, cwd=start_dir, env=env) |
nothing calls this directly
no test coverage detected