From a00d9f15385eaf0bcfebc2442e352a4391d3c08e Mon Sep 17 00:00:00 2001 From: Michael Krasnitski <42564254+mkrasnitski@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:38:03 -0400 Subject: [PATCH] Apply review suggestion Co-authored-by: Grazfather --- gef.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gef.py b/gef.py index 93c1d83d9..2f0fc1d61 100644 --- a/gef.py +++ b/gef.py @@ -1936,10 +1936,9 @@ def gef_pybytes(x: str) -> bytes: @lru_cache() def which(program: str) -> pathlib.Path: """Locate a command on the filesystem.""" - path = shutil.which(program) - if path: - return pathlib.Path(path) - else: + try: + return pathlib.Path(shutil.which(program)) + except TypeError: raise FileNotFoundError(f"Missing file `{program}`")