Переглянути джерело

Always create the output file if it is missing

Zachary Kotlarek 13 роки тому
батько
коміт
8023be4168
1 змінених файлів з 2 додано та 1 видалено
  1. 2 1
      serial/serial.pl

+ 2 - 1
serial/serial.pl

@@ -275,7 +275,8 @@ while (1) {
 			$STATUS{$cmd}->{'status'} =~ s/[^\w\.\-]/_/g;
 
 			# If something has changed, save the state to disk
-			if ($STATUS{$cmd}->{'status'} ne $STATUS{$cmd}->{'last'}) {
+			# (if the output file does not exist, something has changed)
+			if ($STATUS{$cmd}->{'status'} ne $STATUS{$cmd}->{'last'} || !-r $STATUS{$cmd}->{'path'}) {
 				if ($DEBUG) {
 					print STDERR 'New ' . uc($DEV) . ' status: ' . $cmd . ' => ' . $STATUS{$cmd}->{'status'} . "\n";
 				}