fix bashism that prevents building with /bin/sh->/bin/dash
[fw/altos] / altosui / AltosEepromDelete.java
index 94951ced3758c66be524b980643d394accb98fe8..a9d77788d06f84be4800ae0d8d4fb4255bb6ff99 100644 (file)
@@ -42,7 +42,7 @@ public class AltosEepromDelete implements Runnable {
        private void DeleteLog (AltosEepromLog log)
                throws IOException, InterruptedException, TimeoutException {
 
-               if (flights.config_data.flight_log_max != 0) {
+               if (flights.config_data.flight_log_max != 0 || flights.config_data.log_format != 0) {
 
                        /* Devices with newer firmware can erase the
                         * flash blocks containing each flight
@@ -104,10 +104,14 @@ public class AltosEepromDelete implements Runnable {
                                                  serial_line.device.toShortString()),
                                    "Connection Failed");
                } finally {
-                       if (remote)
-                               serial_line.stop_remote();
-                       serial_line.flush_output();
-                       serial_line.close();
+                       try {
+                               if (remote)
+                                       serial_line.stop_remote();
+                       } catch (InterruptedException ie) {
+                       } finally {
+                               serial_line.flush_output();
+                               serial_line.close();
+                       }
                }
                if (listener != null) {
                        Runnable r = new Runnable() {