[LON-CAPA-cvs] cvs: modules /gerd/maxima lonmaxima
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 04 Mar 2006 06:51:03 -0000
albertel Sat Mar 4 01:51:03 2006 EDT
Modified files:
/modules/gerd/maxima lonmaxima
Log:
- check for ref status before trying to use them as such
Index: modules/gerd/maxima/lonmaxima
diff -u modules/gerd/maxima/lonmaxima:1.8 modules/gerd/maxima/lonmaxima:1.9
--- modules/gerd/maxima/lonmaxima:1.8 Sat Mar 4 01:44:11 2006
+++ modules/gerd/maxima/lonmaxima Sat Mar 4 01:51:02 2006
@@ -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 @@
$SIG{ALRM} = sub { kill 9 => $maximapid; };
alarm(5);
- no strict 'refs';
my $selector = IO::Select->new();
@@ -82,7 +81,9 @@
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 @@
}
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);
}