1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Error message if launcher is null when trying to watchProcess

Part of #125
This commit is contained in:
Jonah Graham 2022-10-28 22:56:15 -04:00
parent 7e142b4a34
commit 9cc97ac406

View file

@ -74,6 +74,7 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@ -521,6 +522,7 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
* @since 8.0
*/
protected int watchProcess(IConsole console, IProgressMonitor monitor) throws CoreException {
assertLauncherNotNull(launcher);
return launcher.waitAndRead(console.getInfoStream(), console.getErrorStream(), monitor);
}
@ -529,10 +531,15 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
* @since 8.0
*/
protected int watchProcess(IConsoleParser[] consoleParsers, IProgressMonitor monitor) throws CoreException {
assertLauncherNotNull(launcher);
ConsoleOutputSniffer sniffer = new ConsoleOutputSniffer(consoleParsers);
return launcher.waitAndRead(sniffer.getOutputStream(), sniffer.getErrorStream(), monitor);
}
private void assertLauncherNotNull(ICommandLauncher launcher) {
Assert.isNotNull(launcher, "Only processes launched with startBuildProcess can be watched."); //$NON-NLS-1$
}
private File getScannerInfoCacheFile() {
return CCorePlugin.getDefault().getStateLocation().append("infoCache") //$NON-NLS-1$
.append(getProject().getName()).append(name + ".json").toFile(); //$NON-NLS-1$