chore: reduce lint and type-check noise #187
@@ -38,12 +38,15 @@ def filter_select(
|
|||||||
except OSError:
|
except OSError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Note: Don't close tty_fd here. FileIO in _run_picker wraps the same
|
try:
|
||||||
# file descriptor and manages its lifecycle. Closing tty_fd would close
|
# Use os.dup() to duplicate the fd so the original file object
|
||||||
# the underlying fd, causing "Bad file descriptor" errors when FileIO
|
# and FileIO in _run_picker each manage independent copies,
|
||||||
# tries to use it. Let the file object be closed by garbage collection.
|
# preventing double-close errors.
|
||||||
result = _run_picker(items, title=title, tty_fd=tty_fd.fileno())
|
import os as _os
|
||||||
return result
|
fd_dup = _os.dup(tty_fd.fileno())
|
||||||
|
return _run_picker(items, title=title, tty_fd=fd_dup)
|
||||||
|
finally:
|
||||||
|
tty_fd.close()
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user