mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
fixed hanging with autobuild
This commit is contained in:
parent
7b0bfa370a
commit
6eda5dd984
3 changed files with 41 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-11-22 David Inglis
|
||||||
|
* src/.../cdt/core/CommandLauncher.java
|
||||||
|
Make CommandLauncher.waitAndRead do the stream writing, since ui components
|
||||||
|
process this stream, and this method may be call in a ui thread.
|
||||||
|
|
||||||
2002-11-20 David Inglis
|
2002-11-20 David Inglis
|
||||||
* src/.../internal/core/CBuilder.java
|
* src/.../internal/core/CBuilder.java
|
||||||
fix AUTO_BUILDs so that the builder only builds when the resources change
|
fix AUTO_BUILDs so that the builder only builds when the resources change
|
||||||
|
|
|
@ -7,13 +7,15 @@ package org.eclipse.cdt.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.PipedInputStream;
|
||||||
|
import java.io.PipedOutputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.cdt.internal.core.ProcessClosure;
|
||||||
import org.eclipse.cdt.utils.spawner.EnvironmentReader;
|
import org.eclipse.cdt.utils.spawner.EnvironmentReader;
|
||||||
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
||||||
import org.eclipse.cdt.internal.core.*;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
|
||||||
public class CommandLauncher {
|
public class CommandLauncher {
|
||||||
|
@ -120,12 +122,38 @@ public class CommandLauncher {
|
||||||
if (fProcess == null) {
|
if (fProcess == null) {
|
||||||
return ILLEGAL_COMMAND;
|
return ILLEGAL_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessClosure closure= new ProcessClosure(fProcess, out, err);
|
PipedOutputStream errOutPipe = new PipedOutputStream();
|
||||||
|
PipedOutputStream outputPipe = new PipedOutputStream();
|
||||||
|
PipedInputStream errInPipe, inputPipe;
|
||||||
|
try {
|
||||||
|
errInPipe = new PipedInputStream(errOutPipe);
|
||||||
|
inputPipe = new PipedInputStream(outputPipe);
|
||||||
|
} catch( IOException e ) {
|
||||||
|
return COMMAND_CANCELED;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessClosure closure= new ProcessClosure(fProcess, outputPipe, errOutPipe);
|
||||||
closure.runNonBlocking();
|
closure.runNonBlocking();
|
||||||
|
byte buffer[] = new byte[1024];
|
||||||
|
int nbytes;
|
||||||
while (!monitor.isCanceled() && closure.isAlive()) {
|
while (!monitor.isCanceled() && closure.isAlive()) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(DELAY);
|
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();
|
||||||
|
}
|
||||||
|
} catch( IOException e) {
|
||||||
|
}
|
||||||
|
monitor.worked(0);
|
||||||
|
try {
|
||||||
|
Thread.sleep(DELAY);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,9 +172,9 @@ public class CBuilder extends ACBuilder {
|
||||||
cos.flush();
|
cos.flush();
|
||||||
fatalBuild = true;
|
fatalBuild = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
subMonitor.done();
|
subMonitor.done();
|
||||||
monitor.setCanceled(isCanceled);
|
monitor.setCanceled(isCanceled);
|
||||||
|
cos.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue