Skip to content

Commit 8045b8f

Browse files
committed
Fix ValueError: I/O operation on closed file.
1 parent 6a58564 commit 8045b8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/prompt_toolkit/application/current.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ def __repr__(self) -> str:
5353

5454
@property
5555
def input(self) -> Input:
56-
if self._input is None:
56+
if self._input is None or self._input.closed:
5757
from prompt_toolkit.input.defaults import create_input
5858

5959
self._input = create_input()
6060
return self._input
6161

6262
@property
6363
def output(self) -> Output:
64-
if self._output is None:
64+
if self._output is None or (self._output.stdout and self._output.stdout.closed):
6565
from prompt_toolkit.output.defaults import create_output
6666

6767
self._output = create_output()

0 commit comments

Comments
 (0)