ask for response on unknown
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 22 Feb 2019 08:51:16 +0000 (09:51 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 22 Feb 2019 08:51:16 +0000 (09:51 +0100)
terminal-emulator.pl

index 9a4b485..781d353 100755 (executable)
@@ -34,22 +34,21 @@ my @send_receive = grep { /^.+$/ } split(/\n/, q{
 .ACTION CMENUS0
 
 .NOP
-.NOP 
-
+.NOP
 
 .NOP
-.NOP 
+.NOP
 
 .NOP
-.NOP 
+.NOP
 
 .NOP
-.NOP 
+.NOP
 
 .NOP
 .NOP
 
-.END 
+.END
 });
 
 #warn "# send_receive=",dump( \@send_receive );
@@ -61,9 +60,15 @@ while ( @send_receive ) {
        print $socket "$send\r\n";
        my $got = <$socket>;
        $got =~ s/[\r\n]+$//;
-warn dump($send,$expect,$got);
+warn "# send/expect/got ",dump($send,$expect,$got);
        warn "<< $got\n";
-       die "ERROR expected [$expect] got [$got]" if $expect ne $got;
+       if ( $expect ne $got ) {
+               warn "ERROR expected [$expect] got [$got]\n";
+               print "Response>";
+               my $r = <STDIN>; chomp $r;
+               print $socket "$r\r\n";
+       }
+
 }
 
 $socket->close();