]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Rework interaction with the target
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 5 Nov 2013 14:34:41 +0000 (15:34 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 5 Nov 2013 14:36:49 +0000 (15:36 +0100)
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

index 0b8b8fb032cb800509e1cf16c2528286e614188d..815d3ca144c43daadb809f145791c64b0831b089 100755 (executable)
--- 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