mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[wsl] logging: add trace-level logging to find out which code accesses WSL (IJPL-214732)
This is needed to find problematic code which should be disabled if access to WSL is restricted. (cherry picked from commit cf6f60541d8d1cd6604c0a015d21332b7e326e97) IJ-MR-180846 GitOrigin-RevId: c8490a5d1782d2d3ea356fab0c25079c2353b151
This commit is contained in:
committed by
intellij-monorepo-bot
parent
08dcee3431
commit
4c7e2a21dc
@@ -42,6 +42,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -431,10 +432,15 @@ public class WSLDistribution implements AbstractWslDistribution {
|
||||
testOverriddenWslExe = path;
|
||||
}
|
||||
|
||||
private static final AtomicBoolean isAttemptToFindWslExeLogged = new AtomicBoolean(false);
|
||||
|
||||
public static @Nullable Path findWslExe() {
|
||||
if (testOverriddenWslExe != null) return testOverriddenWslExe;
|
||||
|
||||
File file = PathEnvironmentVariableUtil.findInPath(WSL_EXE);
|
||||
if (LOG.isTraceEnabled() && isAttemptToFindWslExeLogged.compareAndSet(false, true)) {
|
||||
LOG.trace(new Throwable("findWslExe called"));
|
||||
}
|
||||
return file != null ? file.toPath() : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user