You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2008/11/21 23:10:58 UTC
svn commit: r719731 -
/felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
Author: rickhall
Date: Fri Nov 21 14:10:58 2008
New Revision: 719731
URL: http://svn.apache.org/viewvc?rev=719731&view=rev
Log:
Check to see whether there is a stdin, if not then the thread just exits.
(FELIX-729)
Modified:
felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
Modified: felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java?rev=719731&r1=719730&r2=719731&view=diff
==============================================================================
--- felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java (original)
+++ felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java Fri Nov 21 14:10:58 2008
@@ -110,17 +110,16 @@
if (m_runnable != null)
{
m_runnable.stop();
- m_thread.interrupt();
}
}
private class ShellTuiRunnable implements Runnable
{
- private volatile boolean stop = false;
+ private volatile boolean m_stop = false;
public void stop()
{
- stop = true;
+ m_stop = true;
}
public void run()
@@ -128,7 +127,17 @@
String line = null;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- while (!stop)
+ // Check to see if we have stdin.
+ try
+ {
+ System.in.available();
+ }
+ catch (IOException ex)
+ {
+ m_stop = true;
+ }
+
+ while (!m_stop)
{
System.out.print("-> ");
@@ -176,4 +185,4 @@
}
}
}
-}
\ No newline at end of file
+}