mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Bug 580113: Expose concurrent invocations
The class CommandLauncher holds an internal state of the process and it's command line. To avoid corrupting the internal state, only allow executing new commands if the previous command is finished. Contributed by STMicroelectronics Change-Id: If41816f6b642953776a4fea3df9f341a17712222 Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
This commit is contained in:
parent
a9c3819565
commit
4a1e0f467b
1 changed files with 13 additions and 0 deletions
|
@ -16,6 +16,8 @@ package org.eclipse.cdt.core;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.cdt.internal.core.Cygwin;
|
||||
|
@ -161,6 +163,17 @@ public class CommandLauncher implements ICommandLauncher {
|
|||
@Override
|
||||
public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
|
||||
// Ensure that previous command has finished before launching next.
|
||||
if (fProcess != null && fProcess.isAlive()) {
|
||||
String command = "(unknown)"; //$NON-NLS-1$
|
||||
if (fCommandArgs != null) {
|
||||
command = Arrays.asList(fCommandArgs).toString();
|
||||
}
|
||||
throw new ConcurrentModificationException(
|
||||
NLS.bind("Process for command \"{0}\" is still executing.", command)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
parseEnvironment(env);
|
||||
String envPathValue = getEnvironmentProperty(PATH_ENV);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue