From 5d8930b29acb3b56aca11f9ada00b12024cef5ac Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Wed, 6 Apr 2022 21:04:57 -0700 Subject: [PATCH] file_scripts/fzf: general code cleanup --- file_scripts/fzf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/file_scripts/fzf.py b/file_scripts/fzf.py index 9c9201b..09066e6 100644 --- a/file_scripts/fzf.py +++ b/file_scripts/fzf.py @@ -50,14 +50,14 @@ def select_file_with_fzf(files): :param files: stream of null-terminated files to read :type files: bytes stream (stdout of a completed process) - :returns: selected file + :returns: path of selected file :rtype: path-like object :raises: FZFError if there was an error with fzf or no file was selected """ - output = subprocess.run([FZF_CMD, *FZF_OPTS], input=files, stdout=subprocess.PIPE) - try: - output.check_returncode() + output = subprocess.run( + (FZF_CMD, *FZF_OPTS), input=files, capture_output=True, check=True + ) except subprocess.CalledProcessError as e: raise FZFError(e.returncode, e.stderr) from e else: