diff options
author | Thomas Watson | 2008-04-09 16:31:22 +0000 |
---|---|---|
committer | Thomas Watson | 2008-04-09 16:31:22 +0000 |
commit | 8222f6bbae3c39c3666eb904317beb075368ad4b (patch) | |
tree | aebc23378b87d3cbc86aa95ca5192d4b0b669cbc /bundles | |
parent | c2847827a11ad3ad37a83da365710d2081f1643a (diff) | |
download | rt.equinox.framework-8222f6bbae3c39c3666eb904317beb075368ad4b.tar.gz rt.equinox.framework-8222f6bbae3c39c3666eb904317beb075368ad4b.tar.xz rt.equinox.framework-8222f6bbae3c39c3666eb904317beb075368ad4b.zip |
Bug 226053 eclipse -console < /dev/null prints infinite loop
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkConsole.java | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkConsole.java b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkConsole.java index 35b32334d..849648aa3 100644 --- a/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkConsole.java +++ b/bundles/org.eclipse.osgi/console/src/org/eclipse/osgi/framework/internal/core/FrameworkConsole.java @@ -220,16 +220,7 @@ public class FrameworkConsole implements Runnable { while (!shutdown) { if (useSocketStream && !getSocketStream()) return; - try { - console(); - } catch (IOException e) { - if (!shutdown) - e.printStackTrace(out); - if (!useSocketStream) { - // better just return; the standard console has failed us. Don't want to get in an endless loop (bug 212313) - return; - } - } + console(); } } @@ -260,7 +251,7 @@ public class FrameworkConsole implements Runnable { * is reached. This method will then return. * @throws IOException */ - protected void console() throws IOException { + protected void console() { // wait to receive commands from console and handle them BufferedReader br = in; //cache the console prompt String @@ -270,20 +261,28 @@ public class FrameworkConsole implements Runnable { out.flush(); String cmdline = null; - if (blockOnready && !useSocketStream) { - // bug 40066: avoid waiting on input stream - apparently generates contention with other native calls - try { - while (!br.ready()) - Thread.sleep(300); + try { + if (blockOnready && !useSocketStream) { + // bug 40066: avoid waiting on input stream - apparently generates contention with other native calls + try { + while (!br.ready()) + Thread.sleep(300); + cmdline = br.readLine(); + } catch (InterruptedException e) { + // do nothing; probably got disconnected + } + } else cmdline = br.readLine(); - } catch (InterruptedException e) { - // do nothing; probably got disconnected - } - } else - cmdline = br.readLine(); - - if (cmdline == null) + } catch (IOException ioe) { + if (!shutdown) + ioe.printStackTrace(out); + } + if (cmdline == null) { + if (!useSocketStream) + // better shutdown; the standard console has failed us. Don't want to get in an endless loop (bug 212313) (bug 226053) + shutdown(); break; + } if (!shutdown) docommand(cmdline); } |