+ }
+ elsif($command_executed and $expected_result_line)
+ {
+ if($no_output_ignore){
+ @buffer = ();
+ if($sort == 1)
+ {
+ @list3 = sort @list1;
+ @list1=();
+ @list1=@list3;
+ @list3=();
+
+ @list3 = sort @list2;
+ @list2=();
+ @list2=@list3;
+ @list3=();
+
+ $sort=0;
+ }
+ if($SIGABRT)
+ {
+ push @list2,"Aborted";
+ $SIGABRT = 0;
+ }
+
+ while(@list1 or @list2)
+ {
+ if(@list1){$line1 = shift (@list1);$expected_result_line = "x$line1";}
+ if(@list2){$line2 = shift (@list2);$command_executed = "x$line2";}
+ if($command_executed and $expected_result_line)
+ {
+
+ if($line1 eq $line2){
+ if($verbose == 1){print color("green"),"[Tesh/VERB] $line1\n",color("reset");}
+ else{push @buffer, "[Tesh/CRITICAL] $line1\n";}
+
+ }
+ else
+ { if($verbose == 0){print color("green"),@buffer,color("reset");}
+ if($line2) {print color("red"), "[Tesh/CRITICAL] - $line2",color("reset"),"\n";}
+ if($line1) {print color("red"), "[Tesh/CRITICAL] + $line1",color("reset"),"\n";}
+ die;
+ }
+ }
+ else
+ { if($verbose == 0){print color("green"),@buffer,color("reset");}
+ if($line2) {print color("red"), "[Tesh/CRITICAL] - $line2",color("reset"),"\n";}
+ if($line1) {print color("red"), "[Tesh/CRITICAL] + $line1",color("reset"),"\n";}
+ die;
+ }
+ }
+ }else{$no_output_ignore = 1;}
+ $command_executed = 0;
+ $expected_result_line = 0;
+ @list1=();
+ @list2=();
+ @buffer = ();
+ $tesh_command=0;
+ @buffer_tesh=();
+ }
+
+}
+
+if(@list_of_commands){ # need parallel execution
+ $execline = ();
+ $sort = 1; # need sort output
+ while(@list_of_commands)
+ {
+ $command = shift (@list_of_commands);
+ if($execline){$execline = "$command & $execline";}
+ else{$execline = "$command";}
+ }
+ print "[Tesh/INFO] exec_line : $execline\n";
+ $pid = open3(\*IN, \*OUT, \*OUT,"$execline");
+
+ if( $timeout){
+ $forked = fork();die "fork() failed: $!" unless defined $forked;
+ if ( $forked == 0 )
+ {
+ sleep $timeout;
+ kill(9, $pid);
+ exit;
+ }
+ }
+
+ while(@buffer)
+ {
+ $line1 = shift (@buffer);
+ print IN $line1;
+ }
+ close IN ;
+ waitpid( $pid, 0 );
+ if($timeout){kill(9, $forked);$timeout=0;}
+ $timeout = 0;
+
+ @list1=();
+ while(defined($linebis=<OUT>))
+ {
+ $linebis =~ s/\r//g;
+ $linebis =~ s/^( )*//g;
+ chomp $linebis;
+ push @list1,"$linebis";
+ }
+ close OUT;
+ $command_executed = 1;