mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-21 06:36:02 +00:00
Use with instead of closing manually
This commit is contained in:
parent
47dbaac54f
commit
8bb2da3c37
1 changed files with 2 additions and 3 deletions
|
|
@ -449,9 +449,8 @@ def process_single_item(
|
|||
file_removed = False
|
||||
try:
|
||||
if isinstance(item, bytes):
|
||||
tf = NamedTemporaryFile(prefix='stdin-image-data-', delete=False)
|
||||
tf.write(item)
|
||||
tf.close()
|
||||
with NamedTemporaryFile(prefix='stdin-image-data-', delete=False) as tf:
|
||||
tf.write(item)
|
||||
item = tf.name
|
||||
is_tempfile = True
|
||||
if url_pat is not None and url_pat.match(item) is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue