version 1.27, 2007/04/26 02:46:39
|
version 1.32, 2007/08/03 18:18:05
|
Line 237 sub make_new_child {
|
Line 237 sub make_new_child {
|
return; |
return; |
} else { |
} else { |
# Child can *not* return from this subroutine. |
# Child can *not* return from this subroutine. |
$SIG{INT} = 'DEFAULT'; # make SIGINT kill us as it did before |
|
|
|
# unblock signals |
# unblock signals |
sigprocmask(SIG_UNBLOCK, $sigset) |
sigprocmask(SIG_UNBLOCK, $sigset) |
Line 246 sub make_new_child {
|
Line 246 sub make_new_child {
|
&logthis('New process started'); |
&logthis('New process started'); |
|
|
my $command=Expect->spawn('maxima'); |
my $command=Expect->spawn('maxima'); |
$command->log_stdout(0); |
# soft/hard_close can take awhile and we really |
|
# don't care we just want it gone |
|
$SIG{INT} = sub { |
|
my $pid = $command->pid(); |
|
kill('KILL'=>$pid); |
|
exit; |
|
}; |
|
|
|
$command->log_stdout(0); |
#$command->log_file("$execdir/logs/lonmaxima.session.log"); |
#$command->log_file("$execdir/logs/lonmaxima.session.log"); |
&getmaximaoutput($command); |
&getmaximaoutput($command); |
|
|
for (my $i=0; $i < $MAX_CLIENTS_PER_CHILD; $i++) { |
for (my $i=0; $i < $MAX_CLIENTS_PER_CHILD; $i++) { |
&status('Accepting connections'); |
&status('Accepting connections'); |
my $client = $server->accept() or last; |
my $client = $server->accept() or last; |
print $command "kill(all);\n"; |
print $command ("display2d:false;kill(all);\n"); |
&getmaximaoutput($command,2); |
&getmaximaoutput($command,2); |
&sync($command); |
&sync($command); |
my $syntaxerr = 0; |
my $syntaxerr = 0; |
Line 333 sub getmaximaoutput {
|
Line 341 sub getmaximaoutput {
|
} |
} |
$output =~ s/\r+//g; # Remove Windows-style linebreaks |
$output =~ s/\r+//g; # Remove Windows-style linebreaks |
my $foundoutput=0; |
my $foundoutput=0; |
|
my $found_label=0; |
my $realoutput=''; |
my $realoutput=''; |
foreach my $line (split(/\n/,$output)) { |
foreach my $line (split(/\n/,$output)) { |
if ($line=~/\;/) { $foundoutput=1; next; } |
if ($line=~/\;/) { $foundoutput=1; next; } |
if (!$foundoutput) { next; } |
if (!$foundoutput) { next; } |
if ($line=~/^Incorrect syntax:/) { $syntaxerr = 1; next; } |
if ($line=~/^Incorrect syntax:/) { $syntaxerr = 1; next; } |
(my $label, $line) = ($line=~ /^(\(\%o\d+\))(.+)$/); |
if ($line=~ /^(\(\%o\d+\))(.+)$/){ |
if ($label) { |
my $label = $1; |
$label=~s/\S/ /g; |
$line = $2; |
|
$label =~s/\S/ /g; |
$line=$label.$line; |
$line=$label.$line; |
|
$found_label=1; |
|
} |
|
if ($found_label) { |
|
$realoutput.=$line."\n"; |
} |
} |
$realoutput.=$line."\n"; |
|
} |
} |
if (wantarray) { |
if (wantarray) { |
return ($realoutput,$syntaxerr); |
return ($realoutput,$syntaxerr); |