Skip to content

Commit 2964a33

Browse files
committed
Use canAccess to speed up JVM checks a little on Linux
1 parent 22cd7d9 commit 2964a33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interceptors/jvm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { HtkConfig } from '../config';
77
import { spawnToResult, waitForExit } from '../process-management';
88
import { OVERRIDE_JAVA_AGENT } from './terminal/terminal-env-overrides';
99
import { reportError } from '../error-tracking';
10-
import { commandExists, delay } from '../util';
10+
import { commandExists, delay, canAccess } from '../util';
1111

1212
type JvmTarget = { pid: string, name: string, interceptedByProxy: number | undefined };
1313

@@ -56,7 +56,7 @@ const javaBinPromise: Promise<string | false> = (async () => {
5656

5757
// Try to use use Mac's java_home helper (available since 10.5 apparently)
5858
async function getMacJavaHome() {
59-
if (!await commandExists('/usr/libexec/java_home')) return;
59+
if (!await canAccess('/usr/libexec/java_home')) return;
6060

6161
const result = await spawnToResult('/usr/libexec/java_home', ['-v', '1.9+']);
6262
if (result.exitCode != 0) return;

0 commit comments

Comments
 (0)