Windows 10: rusEfi console sometimes crashes within SerialIoStreamJSSC #849

This commit is contained in:
rusefi 2019-06-22 08:02:07 -04:00
parent 2e4342bf8c
commit 421541a89e
3 changed files with 10 additions and 5 deletions

View File

@ -16,7 +16,6 @@ import org.jetbrains.annotations.Nullable;
* (c) Andrey Belomutskiy
*/
public class PortHolder {
public static final String OS_VERSION = "os.version";
public static int BAUD_RATE = 115200;
private static PortHolder instance = new PortHolder();
private final Object portLock = new Object();
@ -71,8 +70,8 @@ public class PortHolder {
}
private static boolean isWindows10() {
// numeric winnt version for "Windows 10" is 7
return System.getProperty(OS_VERSION).startsWith("7");
// todo: this code is fragile! What about Windows 11, 12 etc!? this is a problem for the later day :(
return System.getProperty(FileLog.OS_VERSION).startsWith("10");
}
public void close() {

View File

@ -17,6 +17,7 @@ public enum FileLog {
public static final String DIR = "logs/";
public static final String LOG_INFO_TEXT = "Writing logs to '" + DIR + "'";
public static final String OS_VERSION = "os.version";
public static String currentLogName;
public static final String END_OF_TIMESTAND_TAG = "<EOT>: ";
public static final Logger LOGGER = new Logger() {
@ -50,6 +51,13 @@ public enum FileLog {
} catch (FileNotFoundException e) {
throw new IllegalStateException(e);
}
// a bit strange spot for this invocation for sure
printOsInfo();
}
private static void printOsInfo() {
MAIN.logLine("OS name: " + System.getProperty("os.name"));
MAIN.logLine("OS version: " + System.getProperty(OS_VERSION));
}
private FileOutputStream openLog() throws FileNotFoundException {

View File

@ -317,8 +317,6 @@ public class Launcher {
System.out.println("Starting rusEfi UI console " + CONSOLE_VERSION);
FileLog.MAIN.start();
FileLog.MAIN.logLine("OS name: " + System.getProperty("os.name"));
FileLog.MAIN.logLine("OS version: " + System.getProperty(PortHolder.OS_VERSION));
getConfig().load();
FileLog.suspendLogging = getConfig().getRoot().getBoolProperty(GaugesPanel.DISABLE_LOGS);
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());