Переход с python на lua для всех демонов.
[weathermon.git] / bin / weathermon
index 03fad42630200d77a989ee62d40f395aee07f183..6980cc835dfc8e2aa6caa9794e282ce3c8ec7443 100755 (executable)
@@ -388,21 +388,28 @@ end
 records = {}
 
 while 1 do
+
   line=serialin:read("*l")
+
   if line == nil then
     break
   end
-  printLog("Received: "..line);
-  if startswith(line,'{') then
-    processJson(line)
-  else
-    processLine(line)
-  end
 
-  if dump_file then
-    local f = io.open(dump_file,"w")
-    io.output(f)
-    io.write(json.encode(records))
-    io.close(f)
-  end
+  pcall(function ()
+  
+    printLog("Received: "..line)
+    if startswith(line,'{') then
+      processJson(line)
+    else
+      processLine(line)
+    end
+
+    if dump_file then
+      local f = io.open(dump_file,"w")
+      io.output(f)
+      io.write(json.encode(records))
+      io.close(f)
+    end
+  end)
+    
 end