Community
Participate
Working Groups
System.in provided by Eclipse doesn't respond to Thread.interrupt unlike if I run the program from a shell window.
Created attachment 40756 [details] Example program to reproduce bug This program if run from a windows shell will interrupt the CommandReader thread after 3 seconds even though it is in a blocking call to System.in.read. If the program is run from Eclipse the CommandReader thread does not unblock until you enter a key.
Moving to JDT/Debug.
This is a dup of bug 40066, which is caused by: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4809647 If I change the code in the run() method to the following, it works: public void run() { InputStream stdin = Channels.newInputStream(new FileInputStream(FileDescriptor.in).getChannel()); BufferedReader reader = new BufferedReader(new InputStreamReader(stdin)); String line = null; try { while (!reader.ready()) { Thread.sleep(100); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.out.println("READY"); try { while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } } *** This bug has been marked as a duplicate of bug 40066 ***