]> git.proxmox.com Git - pve-installer.git/commitdiff
ui: stdio: replace newlines with whitespaces in prompt messages
authorChristoph Heiss <c.heiss@proxmox.com>
Fri, 17 Nov 2023 13:45:26 +0000 (14:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 17 Nov 2023 16:08:29 +0000 (17:08 +0100)
The line-based protocol currently used cannot handle this properly, so
introduce this as a stop-gap measure - otherwise messages might be cut
off.

This makes it work for now, and the text is wrapped correctely for the
screen width in the TUI anyway - which is the only user of this so far.

Will be reworked properly later on.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [ TL: add fix-me comment ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Proxmox/UI/StdIO.pm

index 0ee6311399c6524d12107b1c2d5456061238d185..75ddbeb6924d81e25710e7c469b426bcca01984c 100644 (file)
@@ -36,6 +36,7 @@ sub finished {
 sub prompt {
     my ($self, $query) = @_;
 
+    $query =~ s/\n/ /g; # FIXME: use a better serialisation (e.g., JSON)
     print STDOUT "prompt: $query\n";
 
     my $response = <STDIN> // ''; # FIXME: error handling?