mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Make sure to drain the pipes.
This commit is contained in:
parent
58b28300a4
commit
b192a6f48a
1 changed files with 23 additions and 1 deletions
|
@ -30,6 +30,8 @@ public class CommandLauncher {
|
||||||
|
|
||||||
protected String fErrorMessage;
|
protected String fErrorMessage;
|
||||||
|
|
||||||
|
private String lineSeparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of milliseconds to pause
|
* The number of milliseconds to pause
|
||||||
* between polling.
|
* between polling.
|
||||||
|
@ -44,6 +46,7 @@ public class CommandLauncher {
|
||||||
public CommandLauncher() {
|
public CommandLauncher() {
|
||||||
fProcess= null;
|
fProcess= null;
|
||||||
fShowCommand= false;
|
fShowCommand= false;
|
||||||
|
lineSeparator = System.getProperty("line.separator", "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,6 +176,25 @@ public class CommandLauncher {
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drain the pipes.
|
||||||
|
try {
|
||||||
|
while (errInPipe.available() > 0 || inputPipe.available() > 0) {
|
||||||
|
if ( errInPipe.available() > 0 ) {
|
||||||
|
nbytes = errInPipe.read(buffer);
|
||||||
|
err.write(buffer, 0, nbytes);
|
||||||
|
err.flush();
|
||||||
|
}
|
||||||
|
if ( inputPipe.available() > 0 ) {
|
||||||
|
nbytes = inputPipe.read(buffer);
|
||||||
|
out.write(buffer, 0, nbytes);
|
||||||
|
out.flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errInPipe.close();
|
||||||
|
inputPipe.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +205,7 @@ public class CommandLauncher {
|
||||||
buf.append(commandArgs[i]);
|
buf.append(commandArgs[i]);
|
||||||
buf.append(' ');
|
buf.append(' ');
|
||||||
}
|
}
|
||||||
buf.append('\n');
|
buf.append(lineSeparator);
|
||||||
try {
|
try {
|
||||||
os.write(buf.toString().getBytes());
|
os.write(buf.toString().getBytes());
|
||||||
os.flush();
|
os.flush();
|
||||||
|
|
Loading…
Add table
Reference in a new issue