@@ -21,17 +21,25 @@ const isJavaAvailable = commandExists('java').then(async (isAvailable) => {
21
21
]
22
22
) ;
23
23
24
- return result . exitCode === 0 ;
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.
26
+ if ( result . exitCode !== 0 ) {
27
+ console . log ( result . stdout ) ;
28
+ console . log ( result . stderr ) ;
29
+ throw new Error ( `JVM attach not available, exited with ${ result . exitCode } ` ) ;
30
+ } else {
31
+ return true ;
32
+ }
25
33
} ) . catch ( ( e ) => {
26
- // This is expected to happen occasionally, e.g. when using Java 8 (which doesn't support
27
- // the VM attachment APIs we need).
28
- console . log ( "Error checking for JVM targets" , e ) ;
34
+ // This is expected to happen occasionally, e.g. when using Java 8 (which
35
+ // doesn't support the VM attachment APIs we need).
36
+ reportError ( e ) ;
29
37
return false ;
30
38
} ) ;
31
39
32
40
export class JvmInterceptor implements Interceptor {
33
41
readonly id = 'attach-jvm' ;
34
- readonly version = '1.0.0 ' ;
42
+ readonly version = '1.0.1 ' ;
35
43
36
44
private interceptedProcesses : {
37
45
[ pid : string ] : number // PID -> proxy port
@@ -113,11 +121,12 @@ export class JvmInterceptor implements Interceptor {
113
121
proxyPort . toString ( ) ,
114
122
this . config . https . certPath
115
123
] ,
116
- { } ,
117
- true // Inherit IO, so we can see output easily, if any
124
+ { }
118
125
) ;
119
126
120
127
if ( interceptionResult . exitCode !== 0 ) {
128
+ console . log ( interceptionResult . stdout ) ;
129
+ console . log ( interceptionResult . stderr ) ;
121
130
throw new Error ( `Failed to attach to JVM, exit code ${ interceptionResult . exitCode } ` ) ;
122
131
} else {
123
132
this . interceptedProcesses [ options . targetPid ] = proxyPort ;
0 commit comments