Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress Windows Defender Autofix startup check in test-runtimes part 2 #1686

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,21 @@ public void handleEvent(Event event) {

private static boolean runStartupCheck() {
if (Platform.isRunning() && Platform.OS.isWindows() && !Platform.inDevelopmentMode()) {
IProduct product = Platform.getProduct();
if (product != null) {
return "org.eclipse.ui.ide.workbench".equals(product.getApplication()); //$NON-NLS-1$
}
return "org.eclipse.ui.ide.workbench".equals(getRunningApplicationId()); //$NON-NLS-1$
}
return false;
}

private static String getRunningApplicationId() {
@SuppressWarnings("restriction")
String appId = System.getProperty(org.eclipse.core.internal.runtime.InternalPlatform.PROP_APPLICATION);
if (appId != null) {
return appId;
}
IProduct product = Platform.getProduct();
return product != null ? product.getApplication() : null;
}

Comment on lines +116 to +125
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the System-properties is effectively what's done in the proposed solution in #1453 (comment) (EnvironmentInfo only also considers a potential SecurityManager before reading the System-properties, but I assume that nobody is using SecurityManagers anymore).
It is set at startup in org.eclipse.equinox.internal.app.CommandLineArgs class.

On the long run it might be interesting to have something like this available as API, e.g. Platform.getApplication() similar to Platform.getProduct() since this might be of interest for others as well.

/**
* Opens the dialog to run the exclusion, regardless of any preference.
*
Expand Down
Loading