Skip to content

Commit 0dee1af

Browse files
committed
ESP8266FS tool: pipe esptool output without waiting for newline
1 parent 6b3b769 commit 0dee1af

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/ESP8266FS.java

+20-19
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,27 @@ public String getMenuTitle() {
6060
}
6161

6262
private int listenOnProcess(String[] arguments){
63-
try {
64-
final Process p = ProcessUtils.exec(arguments);
65-
Thread thread = new Thread() {
66-
public void run() {
67-
try {
68-
String line;
69-
BufferedReader input = new BufferedReader (new InputStreamReader(p.getInputStream()));
70-
while ((line = input.readLine()) != null) System.out.println(line);
71-
input.close();
72-
} catch (Exception e){}
73-
}
74-
};
75-
thread.start();
76-
int res = p.waitFor();
77-
thread.join();
78-
return res;
79-
} catch (Exception e){
80-
return -1;
63+
try {
64+
final Process p = ProcessUtils.exec(arguments);
65+
Thread thread = new Thread() {
66+
public void run() {
67+
try {
68+
InputStreamReader reader = new InputStreamReader(p.getInputStream());
69+
int c;
70+
while ((c = reader.read()) != -1)
71+
System.out.print((char) c);
72+
reader.close();
73+
} catch (Exception e){}
74+
}
75+
};
76+
thread.start();
77+
int res = p.waitFor();
78+
thread.join();
79+
return res;
80+
} catch (Exception e){
81+
return -1;
82+
}
8183
}
82-
}
8384

8485
private void sysExec(final String[] arguments){
8586
Thread thread = new Thread() {

0 commit comments

Comments
 (0)