Zachary Kotlarek 13 лет назад
Родитель
Сommit
38a3d07e94
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      dmx/projectorPower.pl

+ 12 - 2
dmx/projectorPower.pl

@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #!/usr/bin/perl
 use strict;
 use strict;
 use warnings;
 use warnings;
-use POSIX qw(ceil floor);
+use POSIX;
 
 
 # Local modules
 # Local modules
 use Cwd qw(abs_path);
 use Cwd qw(abs_path);
@@ -58,6 +58,9 @@ my $color        = $COLOR_LOW;
 # Loop forever
 # Loop forever
 while (1) {
 while (1) {
 
 
+	# Reap zombie children
+	while (waitpid(-1, WNOHANG) > 0) { }
+
 	# State is calculated; use newState to gather data
 	# State is calculated; use newState to gather data
 	my $newState = $state;
 	my $newState = $state;
 
 
@@ -264,7 +267,14 @@ sub say($) {
 	if ($DEBUG) {
 	if ($DEBUG) {
 		print STDERR 'Say: ' . $str . "\n";
 		print STDERR 'Say: ' . $str . "\n";
 	}
 	}
-	system('say', $str);
+
+	my $pid = fork();
+	if (!defined($pid)) {
+		die('Unable to fork: ' . $! . "\n");
+	}
+	if (!$pid) {
+		exec('say', $str);
+	}
 }
 }
 
 
 sub sayShutdown($) {
 sub sayShutdown($) {