diff mbox series

[1/5] python: qmp_shell: don't prompt when stdin is non-interactive

Message ID 20220221155519.2367-2-damien.hedde@greensocs.com (mailing list archive)
State New, archived
Headers show
Series qmp-shell modifications for non-interactive use | expand

Commit Message

Damien Hedde Feb. 21, 2022, 3:55 p.m. UTC
In that case, there is no echo anyway. So the prompt is just
garbage.

Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
---
 python/qemu/aqmp/qmp_shell.py | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/python/qemu/aqmp/qmp_shell.py b/python/qemu/aqmp/qmp_shell.py
index d11bf54b00..a6e0f5af42 100644
--- a/python/qemu/aqmp/qmp_shell.py
+++ b/python/qemu/aqmp/qmp_shell.py
@@ -367,6 +367,8 @@  def prompt(self) -> str:
         """
         Return the current shell prompt, including a trailing space.
         """
+        if not sys.stdin.isatty():
+            return ""
         if self._transmode:
             return 'TRANS> '
         return '(QEMU) '