| Summary: | Process.getInputStream().ready() never succeeds | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Randy Coulman <RCoulman> | ||||
| Component: | Debug | Assignee: | Darin Wright <darin.eclipse> | ||||
| Status: | RESOLVED INVALID | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P1 | CC: | darin.eclipse | ||||
| Version: | 2.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 2000 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Compiler is innocent here, launching issue. Running from a DOS console, using JDK1.4rc, the program does run either. Using 1.3.1_01, the program runs from a console, but not within Eclipse. Appears to be an issue with the command being run. When I run "ping 127.1.1.0", I can get output with no trouble. When I use "command.com /C ipconfig /all", I do not get output. When running "command.com /C ipconfig /all" on 1.4rc, eventually a error dialog appears. See attachment. Created attachment 348 [details]
error dialog
Some more experimentation (triggered by the attached error message) shows that I can use cmd.exe in the command line instead of command.com and everything works fine. Going further, I find I don't even need the cmd.exe /C at all. I can just use ipconfig /all as the command line and get what I need. Given these results, this issue is no longer a blocker for us. A command issue. Closing. |
We have an application that launches a command-line process using Runtime.exec(), then uses Process.getInputStream() to read what is output on the console. It has a loop waiting for the stream to be ready() before actually trying to read any input. When running this application from the command line or from Kawa (our hopefully soon-to-be-previous Java development environment), this works fine. However, when running (or debugging) under Eclipse, the call to ready() never succeeds. This is done during the startup of our application, so we are completely unable to run or debug using Eclipse because of this problem. Here is a small, self-contained example program that illustrates the problem. If you run or debug this in Eclipse, it will hang on the while(!in.ready()) loop. If you run from the command line, using the class file compiled by Eclipse, the program runs to completion. I am using Eclipse 2.0 latest stable build (01/25/2002) and Sun's JDK 1.3.0. import java.io.*; public class BugTest { public BugTest() { super(); } public static void main(String[] args) { try { System.out.println("Running command..."); Process p = (Runtime.getRuntime()).exec("command.com /C ipconfig /all"); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); while (!in.ready()) { } System.out.println("Will never get here."); while (in.ready()) { System.out.println(in.readLine()); } p.destroy(); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }