Skip to content

Commit 5f46aec

Browse files
committed
Fix stdio redirection, fix: #1958
1 parent 199f3f3 commit 5f46aec

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

hanlp/utils/io_util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,11 @@ def stdout_redirected(to=os.devnull, stdout=None):
555555
return
556556
if stdout is None:
557557
stdout = sys.stdout
558-
stdout_fd = fileno(stdout)
558+
try:
559+
stdout_fd = fileno(stdout)
560+
except ValueError:
561+
yield None
562+
return
559563
if not stdout_fd:
560564
yield None
561565
return

hanlp/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Author: hankcs
33
# Date: 2019-12-28 19:26
44

5-
__version__ = '2.1.1'
5+
__version__ = '2.1.2'
66
"""HanLP version"""
77

88

0 commit comments

Comments
 (0)