--- loncom/lonmaxima 2006/03/04 06:44:11 1.8 +++ loncom/lonmaxima 2006/03/04 06:51:02 1.9 @@ -3,7 +3,7 @@ # The LearningOnline Network with CAPA # Connect to MAXIMA CAS # -# $Id: lonmaxima,v 1.8 2006/03/04 06:44:11 albertel Exp $ +# $Id: lonmaxima,v 1.9 2006/03/04 06:51:02 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,7 +74,6 @@ sub maximareply { $SIG{ALRM} = sub { kill 9 => $maximapid; }; alarm(5); - no strict 'refs'; my $selector = IO::Select->new(); @@ -82,7 +81,9 @@ sub maximareply { while (my @ready = $selector->can_read()) { foreach my $fh (@ready) { - if (fileno($fh) == fileno($cmd_err)) { + if (ref($fh) + && ref($cmd_err) + && fileno($fh) == fileno($cmd_err)) { $error.=<$cmd_err>; } else { my $line = scalar(<$cmd_out>); @@ -96,9 +97,9 @@ sub maximareply { } alarm(0); $SIG{ALRM} = 'DEFAULT'; - close($cmd_out); - close($cmd_err); - use strict 'refs'; + if (ref($cmd_out)) { close($cmd_out); } + if (ref($cmd_err)) { close($cmd_err); } + &status("Command processed"); return ($reply,$error,$exitstatus); }