From c43629a222c2cbb84d9c3456729408790cad680b Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 17 Aug 2023 15:50:03 -0700 Subject: [PATCH] ruff: Fix PLW1510 `subprocess.run` without explicit `check` argument. Signed-off-by: Anders Kaseorg --- .../zulip_postgresql_backups/check_postgresql_backup | 1 + scripts/lib/upgrade-zulip-stage-2 | 4 +++- scripts/restart-server | 1 + tools/lib/pretty_print.py | 2 +- zerver/tests/test_email_mirror.py | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/puppet/zulip/files/nagios_plugins/zulip_postgresql_backups/check_postgresql_backup b/puppet/zulip/files/nagios_plugins/zulip_postgresql_backups/check_postgresql_backup index 2f3e268b5f..ead5f96d80 100755 --- a/puppet/zulip/files/nagios_plugins/zulip_postgresql_backups/check_postgresql_backup +++ b/puppet/zulip/files/nagios_plugins/zulip_postgresql_backups/check_postgresql_backup @@ -41,6 +41,7 @@ skip_backups = subprocess.run( ["crudini", "--get", "/etc/zulip/zulip.conf", "postgresql", "skip_backups"], capture_output=True, text=True, + check=False, ) if skip_backups.returncode == 0 and skip_backups.stdout.strip().lower() in [ 1, diff --git a/scripts/lib/upgrade-zulip-stage-2 b/scripts/lib/upgrade-zulip-stage-2 index dabe3a5cb2..b8393e39fc 100755 --- a/scripts/lib/upgrade-zulip-stage-2 +++ b/scripts/lib/upgrade-zulip-stage-2 @@ -399,7 +399,9 @@ has_puppet_changes = True if not args.skip_puppet and IS_SERVER_UP: logging.info("Pre-checking for puppet changes...") try_puppet = subprocess.run( - ["./scripts/zulip-puppet-apply", "--noop", "--force"], stdout=subprocess.DEVNULL + ["./scripts/zulip-puppet-apply", "--noop", "--force"], + stdout=subprocess.DEVNULL, + check=False, ) if try_puppet.returncode == 0: if minimal_change: diff --git a/scripts/restart-server b/scripts/restart-server index 45a9e08f6e..e36c643ba2 100755 --- a/scripts/restart-server +++ b/scripts/restart-server @@ -185,6 +185,7 @@ if has_application_server(): uwsgi_status = subprocess.run( ["supervisorctl", "status", "zulip-django"], stdout=subprocess.DEVNULL, + check=False, ) if uwsgi_status.returncode == 0: logging.info("Starting rolling restart of django server") diff --git a/tools/lib/pretty_print.py b/tools/lib/pretty_print.py index bb29bd5ac8..4c1db87982 100644 --- a/tools/lib/pretty_print.py +++ b/tools/lib/pretty_print.py @@ -180,7 +180,7 @@ Proposed {BOLDRED}diff{ENDC} for {CYAN}{fn}{ENDC}: """, flush=True, ) - subprocess.run(["diff", fn, "-"], input=phtml, text=True) + subprocess.run(["diff", fn, "-"], input=phtml, text=True, check=False) print( f""" --- diff --git a/zerver/tests/test_email_mirror.py b/zerver/tests/test_email_mirror.py index 6b78fd5776..debd952cb1 100644 --- a/zerver/tests/test_email_mirror.py +++ b/zerver/tests/test_email_mirror.py @@ -1493,6 +1493,7 @@ class TestScriptMTA(ZulipTestCase): input=mail, stdout=subprocess.PIPE, text=True, + check=False, ) self.assertEqual( p.stdout,