Skip to content

Commit 371a839

Browse files
authored
Merge pull request #25 from nicolaskruchten/patch-1
Makes closing stdin optional and false by default
2 parents fb371ae + 935dbe0 commit 371a839

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pdoc/cli.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@
8080
"No link prefix results in all links being relative. "
8181
"No effect when combined with --http.",
8282
)
83+
aa(
84+
"--close-stdin",
85+
action="store_true",
86+
help="When set, stdin will be closed before importing, to account for "
87+
"ill-behaved modules that block on stdin."
88+
)
8389

8490
DEFAULT_HOST, DEFAULT_PORT = 'localhost', 8080
8591

@@ -280,9 +286,8 @@ def main(_args=None):
280286
global args
281287
args = _args or parser.parse_args()
282288

283-
# We close stdin because some modules, upon import, are not very polite
284-
# and block on stdin.
285-
sys.stdin.close()
289+
if args.close_stdin:
290+
sys.stdin.close()
286291

287292
if args.template_dir is not None:
288293
if not path.isdir(args.template_dir):

0 commit comments

Comments
 (0)