summaryrefslogtreecommitdiff
path: root/docutils/io.py
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-03-11 12:09:16 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-03-11 12:09:16 +0000
commite792aa98d868891ca36e4f9501ec4a9345d56ea5 (patch)
tree0b4e27d85f5174b2ae17d16737d0ce97044044ba /docutils/io.py
parent51b730d56f1deaf035aff5b83fdd8a0cf376764c (diff)
downloaddocutils-e792aa98d868891ca36e4f9501ec4a9345d56ea5.tar.gz
core.Publisher.publish(): Prompt when waiting for input from a terminal.
When front-end tools are used without arguments, Docutils reads from stdin. Currently, when a user calls a front-end without arguments, there is no response until the user presses Ctrl-D (Ctrl-Z on Windows) or aborts with Ctrl-C. This commit changes the behaviour to tell the user what the front-end expects and where to get more help. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9043 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/io.py')
-rw-r--r--docutils/io.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/docutils/io.py b/docutils/io.py
index ca0adfbb5..daa7a0b3f 100644
--- a/docutils/io.py
+++ b/docutils/io.py
@@ -175,6 +175,12 @@ class Input(TransformSpec):
return match.group(1).decode('ascii')
return None
+ def isatty(self):
+ try:
+ return self.source.isatty()
+ except AttributeError:
+ return False
+
class Output(TransformSpec):
@@ -304,6 +310,12 @@ class ErrorOutput:
except AttributeError:
pass
+ def isatty(self):
+ try:
+ return self.destination.isatty()
+ except AttributeError:
+ return False
+
class FileInput(Input):