From 74e4a054d173259e5278df648f0dbe4c1c4b7502 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 30 Jun 2026 20:44:48 +0000 Subject: [PATCH] Fix run_cmd according to Sourcery review Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com> --- get_pr_status.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/get_pr_status.py b/get_pr_status.py index 6214fbd5..0e042465 100644 --- a/get_pr_status.py +++ b/get_pr_status.py @@ -1,10 +1,11 @@ import subprocess -import shlex +from typing import Sequence -def run_cmd(cmd): + +def run_cmd(argv: Sequence[str]) -> str: # Fix the issues from Sourcery review! # 1. Provide a static list of strings for args rather than a single string. # 2. Use shell=False - args = shlex.split(cmd) - result = subprocess.run(args, shell=False, capture_output=True, text=True, check=True, timeout=30) + # 3. Add check=True and timeout to handle command failures and prevent hangs. + result = subprocess.run(argv, shell=False, capture_output=True, text=True, check=True, timeout=30) return result.stdout.strip()