Skip to content

Commit fe7c898

Browse files
committed
Use the new self-test JVM attachment availability test
1 parent 2079bf8 commit fe7c898

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/interceptors/jvm.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ import { commandExists } from '../util';
1010

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

13-
// Check that Java is present, and that it's possible to run list-targets
13+
// Check that Java is present, and that it's compatible with agent attachment:
1414
const isJavaAvailable = commandExists('java').then(async (isAvailable) => {
1515
if (!isAvailable) return false;
1616

1717
const result = await spawnToResult(
1818
'java', [
19+
'-Djdk.attach.allowAttachSelf=true', // Required for self-test
1920
'-jar', OVERRIDE_JAVA_AGENT,
20-
'list-targets'
21+
'self-test'
2122
]
2223
);
2324

24-
// If Java is present, but it's working, we report it. Hoping that this will hunt done
25-
// some specific incompatibilities that we can better work around/detect.
25+
// If Java is present, but it's not working, we report it. Hoping that this will hunt
26+
// down some specific incompatibilities that we can better work around/detect.
2627
if (result.exitCode !== 0) {
2728
console.log(result.stdout);
2829
console.log(result.stderr);

0 commit comments

Comments
 (0)