Skip to content

Commit 66ba09e

Browse files
committed
boot-qemu.py: Use contextlib.suppress() instead of try except
As suggested by ruff: boot-qemu.py:792:21: SIM105 Use `contextlib.suppress(KeyboardInterrupt)` instead of try-except-pass Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent b55011d commit 66ba09e

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

boot-qemu.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# pylint: disable=invalid-name
33

44
import argparse
5+
import contextlib
56
import os
67
from pathlib import Path
78
import platform
@@ -785,11 +786,9 @@ def launch_qemu(cfg):
785786
gdb_cmd += [kernel_location.joinpath("vmlinux")]
786787
gdb_cmd += ["-ex", "target remote :1234"]
787788

788-
with subprocess.Popen(gdb_cmd) as gdb_process:
789-
try:
790-
gdb_process.wait()
791-
except KeyboardInterrupt:
792-
pass
789+
with subprocess.Popen(gdb_cmd) as gdb_process, \
790+
contextlib.suppress(KeyboardInterrupt):
791+
gdb_process.wait()
793792

794793
utils.red("Killing QEMU...")
795794
qemu_process.kill()

0 commit comments

Comments
 (0)