From 42a441d568a0c022b9d05ea619eaa5765b086749 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 5 Nov 2013 15:34:41 +0100 Subject: [PATCH] Rework interaction with the target Only set up bi-directional communication if run on terminal. Also specify manual_stty on STDIN to not mess up messages from background server. I will need to play more with terminal settings, because currently it is not ideal. See the comment in the patch. --- novaboot | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/novaboot b/novaboot index 0b8b8fb..815d3ca 100755 --- a/novaboot +++ b/novaboot @@ -721,7 +721,22 @@ if (defined $exp) { # Serial line of the target is available print "novaboot: Serial line interaction (press Ctrl-C to interrupt)...\n"; $exp->log_stdout(1); - $exp->interact(undef, "\cC"); # Interact until Ctrl-C is pressed + my @inputs = ($exp); + if (-t STDIN) { # Set up bi-directional communication if we run on terminal + my $infile = new IO::File; + $infile->IO::File::fdopen(*STDIN,'r'); + my $in_object = Expect->exp_init($infile); + $in_object->set_group($exp); + #$in_object->set_seq("\cC",undef); + + # I'm not sure when to use raw mode and when not. With + # --dhcp-tftp, I want the output of daemons to be normally + # formated (no raw mode). On the other hand, I don't want + # input for qemu to be echoed. Need to think more about this. + $in_object->manual_stty(1); + push(@inputs, $in_object); + } + Expect::interconnect(@inputs); } ## Kill dhcpc or tftpd -- 2.39.2