--- loncom/lonmaxima 2007/02/03 04:09:30 1.23 +++ loncom/lonmaxima 2007/02/08 06:28:30 1.24 @@ -3,7 +3,7 @@ # The LearningOnline Network with CAPA # Connect to MAXIMA CAS # -# $Id: lonmaxima,v 1.23 2007/02/03 04:09:30 raeburn Exp $ +# $Id: lonmaxima,v 1.24 2007/02/08 06:28:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -259,8 +259,8 @@ sub make_new_child { while (my $cmd=<$client>) { &status('Processing command'); print $command &unescape($cmd); - my ($reply,$finished,$syntaxerr) = &getmaximaoutput($command); - if ((!$finished) && (!$syntaxerr) && ($reply !~ /^Error\:/)) { + my ($reply,$finished,$syntaxerr); + while ((!$finished) && (!$syntaxerr) && ($reply !~ /^Error\:/)) { ($reply,$finished,$syntaxerr) = &getmaximaoutput($command); } print $client &escape($reply)."\n"; @@ -304,7 +304,7 @@ sub make_new_child { sub getmaximaoutput { my ($command)=@_; - my (undef,$error,undef,$output)=$command->expect(20, -re => '\(\%i\d+\)'); + my (undef,$error,undef,$output)=$command->expect(20, -re => '^\(\%i\d+\)'); if ($error) { return 'Error: '.$error; }