From 5d2f8b5f8233eb1a505112694ddbd500dd0c05f1 Mon Sep 17 00:00:00 2001 From: eparovyshnaya Date: Sun, 6 Nov 2022 11:21:43 +0300 Subject: [PATCH 1/2] FLS: license assessment cli interaction is broken [2.5.0 release] define input-acceptance trigger symbol basing on OS --- .../equinox/access/ConsoleInteraction.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java b/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java index 746649b19..c9d4b8a80 100644 --- a/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java +++ b/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java @@ -14,8 +14,16 @@ import java.io.IOException; +import org.eclipse.core.runtime.Platform; + public final class ConsoleInteraction implements Interaction { + private final int stop; + + public ConsoleInteraction() { + this.stop = stop(); + } + @Override public void prompt(String information) { System.out.printf("%s\n", information); //$NON-NLS-1$ @@ -26,7 +34,7 @@ public String input() { byte[] bytes = new byte[1024]; int length = 0; try { - for (int symbol = System.in.read(); (symbol != 10) && (symbol != 13); symbol = System.in.read()) { + for (int symbol = System.in.read(); symbol != stop; symbol = System.in.read()) { bytes[length++] = (byte) symbol; } } catch (IOException e) { @@ -41,4 +49,14 @@ public void swear(Throwable thro) { thro.printStackTrace(System.err); } + private int stop() { + if (Platform.getOS().equals(Platform.OS_LINUX)) { + return 10; + } else if (Platform.getOS().equals(Platform.OS_MACOSX)) { + return 10; + } else { + return 13; + } + } + } From 6c17c3f66381555db0df4135eb14d7e1b4590664 Mon Sep 17 00:00:00 2001 From: eparovyshnaya Date: Sun, 6 Nov 2022 12:44:57 +0300 Subject: [PATCH 2/2] FLS: license assessment cli interaction is broken [2.5.0 release] use 13 for WinOS and 10 for all the rest --- .../passage/lic/equinox/access/ConsoleInteraction.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java b/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java index c9d4b8a80..9e3f1dfdd 100644 --- a/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java +++ b/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/equinox/access/ConsoleInteraction.java @@ -50,13 +50,10 @@ public void swear(Throwable thro) { } private int stop() { - if (Platform.getOS().equals(Platform.OS_LINUX)) { - return 10; - } else if (Platform.getOS().equals(Platform.OS_MACOSX)) { - return 10; - } else { + if (Platform.getOS().equals(Platform.OS_WIN32)) { return 13; } + return 10; } }