commit 2dbb56abe445dff88188ef3a7e362d7e1fe35763 parent b430d53c71cbb7e7172de4d60e0b64f8bf6819da Author: Alex Hochheiden <ahochheiden@mozilla.com> Date: Wed, 10 Dec 2025 06:03:27 +0000 Bug 2004174 - Use `check=True` for `subprocess.run` calls that don't check returncode r=emilio,media-playback-reviewers,android-reviewers,geckoview-reviewers,home-newtab-reviewers,alwu,mconley,calu Differential Revision: https://phabricator.services.mozilla.com/D275151 Diffstat:
11 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/browser/components/storybook/mach_commands.py b/browser/components/storybook/mach_commands.py @@ -90,7 +90,7 @@ def start_browser(command_context): # This delay is used to avoid launching the browser before the Storybook server has started. time.sleep(5) subprocess.run( - run_mach(command_context, "storybook", subcommand="launch"), check=False + run_mach(command_context, "storybook", subcommand="launch"), check=True ) diff --git a/browser/extensions/newtab/mach_commands.py b/browser/extensions/newtab/mach_commands.py @@ -284,7 +284,7 @@ def get_message_dates(fluent_file_path): ["git", "blame", "--line-porcelain", fluent_file_path], stdout=subprocess.PIPE, text=True, - check=False, + check=True, ) pattern = re.compile(r"^([a-z-]+[^\s]+) ") diff --git a/config/external/icu/data/convert_icudata.py b/config/external/icu/data/convert_icudata.py @@ -17,5 +17,5 @@ def main(output, data_file): data_file, output.name, ], - check=False, + check=True, ) diff --git a/dom/media/test/reftest/gen_combos.py b/dom/media/test/reftest/gen_combos.py @@ -236,7 +236,7 @@ def run_cmd(args): if "-vv" not in ARGS: dest = subprocess.DEVNULL try: - subprocess.run(args, check=False, stderr=dest) + subprocess.run(args, check=True, stderr=dest) except FileNotFoundError: print("FileNotFoundError, is ffmpeg not in your PATH?") raise diff --git a/js/src/irregexp/import-irregexp.py b/js/src/irregexp/import-irregexp.py @@ -126,7 +126,7 @@ if __name__ == "__main__": provided_path = "the command-line" elif "TASK_ID" in os.environ: src_path = Path("/builds/worker/v8/") - subprocess.run("git pull origin master", check=False, shell=True, cwd=src_path) + subprocess.run("git pull origin master", check=True, shell=True, cwd=src_path) src_path = Path("/builds/worker/v8/src/regexp") provided_path = "the hardcoded path in the taskcluster image" diff --git a/mobile/android/beta-cut.py b/mobile/android/beta-cut.py @@ -130,7 +130,7 @@ def update_json_if_necessary(): if os.path.exists(SOURCE_JSON) and os.path.exists(TARGET_JSON): result = subprocess.run(["cmp", "-s", SOURCE_JSON, TARGET_JSON], check=False) if result.returncode != 0: # Files differ - subprocess.run(["cp", SOURCE_JSON, TARGET_JSON], check=False) + subprocess.run(["cp", SOURCE_JSON, TARGET_JSON], check=True) return True return False diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/generate_smoke_tests.py b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/generate_smoke_tests.py @@ -57,7 +57,7 @@ def create_test_file(): print("File Exists, you need to delete it to create a new one.") return # file exists - subprocess.run([f"touch {final_path}"], check=False, encoding="utf8", shell=True) + subprocess.run([f"touch {final_path}"], check=True, encoding="utf8", shell=True) assert final_path.exists() with open(final_path, "w") as file: file.write("import pytest\n\n") diff --git a/mobile/android/fenix/tools/setup-startup-profiling.py b/mobile/android/fenix/tools/setup-startup-profiling.py @@ -75,9 +75,9 @@ def push(id, filename): print(f"Pushing {filename} to device.") run( ["adb", "push", config.name, os.path.join(PATH_PREFIX, filename)], - check=False, + check=True, ) - run(["adb", "shell", "am", "set-debug-app", "--persistent", id], check=False) + run(["adb", "shell", "am", "set-debug-app", "--persistent", id], check=True) print( "\nStartup profiling enabled on all future start ups, possibly even after reinstall." ) @@ -93,8 +93,8 @@ def push(id, filename): def remove(filename): print(f"Removing {filename} from device.") - run(["adb", "shell", "rm", PATH_PREFIX + "/" + filename], check=False) - run(["adb", "shell", "am", "clear-debug-app"], check=False) + run(["adb", "shell", "rm", PATH_PREFIX + "/" + filename], check=True) + run(["adb", "shell", "am", "clear-debug-app"], check=True) def convert_channel_to_id(product, channel): diff --git a/python/mozboot/mozboot/mach_commands.py b/python/mozboot/mozboot/mach_commands.py @@ -93,7 +93,7 @@ def vcs_setup(command_context, update_only=False, vcs=None): print("Initializing a git colocated jj repository...") jj_bin = get_tool_path("jj") - subprocess.run([jj_bin, "git", "init", "--colocate"], check=False) + subprocess.run([jj_bin, "git", "init", "--colocate"], check=True) if vcs: repo = get_specific_repository_object(topsrcdir, vcs) diff --git a/testing/mozharness/scripts/openh264_build.py b/testing/mozharness/scripts/openh264_build.py @@ -249,10 +249,10 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin): def _git_checkout(self, repo, repo_dir, rev): try: subprocess.run( - ["git", "clone", "-q", "--no-checkout", repo, repo_dir], check=False + ["git", "clone", "-q", "--no-checkout", repo, repo_dir], check=True ) subprocess.run( - ["git", "checkout", "-q", "-f", f"{rev}^0"], check=False, cwd=repo_dir + ["git", "checkout", "-q", "-f", f"{rev}^0"], check=True, cwd=repo_dir ) except Exception: self.rmtree(repo_dir) diff --git a/tools/phabricator/mach_commands.py b/tools/phabricator/mach_commands.py @@ -65,7 +65,7 @@ def install_moz_phab(command_context, force=False): if not moz_phab_path.exists(): moz_phab_path = moz_phab_path.with_suffix(".exe") - subprocess.run([moz_phab_path, "install-certificate"], check=False) + subprocess.run([moz_phab_path, "install-certificate"], check=True) else: command_context.log( logging.WARNING, @@ -75,4 +75,4 @@ def install_moz_phab(command_context, force=False): ) # We run this last, since it instructs the user to restart their shell (if necessary) - subprocess.run(["uv", "tool", "update-shell"], check=False) + subprocess.run(["uv", "tool", "update-shell"], check=True)