@@ -61,7 +61,6 @@ suite('VisualVm Suite Tests', function () {
61
61
} ) ;
62
62
63
63
let testPid : number = 0 ; // pid of a test Java process
64
- let childProcess : cp . ChildProcessWithoutNullStreams ; // test Java process launcher
65
64
let visualvmPid : number = 0 ; // pid of a VisualVM process
66
65
test ( 'Manually Selecting Project Process' , async function ( ) {
67
66
@@ -74,7 +73,7 @@ suite('VisualVm Suite Tests', function () {
74
73
try {
75
74
const jarFilePath = path . join ( projectPath , 'oci/target/oci-1.0-SNAPSHOT.jar' ) ;
76
75
if ( fs . existsSync ( jarFilePath ) ) {
77
- childProcess = cp . spawn ( 'java' , [ TEST_JAVA_PROCESS_PARAMETER , '-jar' , 'oci/target/oci-1.0-SNAPSHOT.jar' ] , { cwd : projectPath } ) ;
76
+ cp . spawn ( 'java' , [ TEST_JAVA_PROCESS_PARAMETER , '-jar' , 'oci/target/oci-1.0-SNAPSHOT.jar' ] , { cwd : projectPath } ) ;
78
77
} else {
79
78
assert ( undefined , 'JAR File does not exist ... The build does not done correctly' ) ;
80
79
}
@@ -287,15 +286,19 @@ suite('VisualVm Suite Tests', function () {
287
286
288
287
this . afterAll ( async ( ) => {
289
288
this . timeout ( 15000 ) ;
290
- if ( childProcess ) {
291
- // TODO: does this throw an error if the process has already finished?
292
- childProcess . kill ( ) ;
293
- }
294
289
if ( testPid ) {
295
- process . kill ( testPid ) ;
290
+ try {
291
+ process . kill ( testPid ) ;
292
+ } catch ( err ) {
293
+ console . log ( `Failed to kill test process PID=${ testPid } : ${ err } ` )
294
+ }
296
295
}
297
296
if ( visualvmPid ) {
298
- process . kill ( visualvmPid ) ;
297
+ try {
298
+ process . kill ( visualvmPid ) ;
299
+ } catch ( err ) {
300
+ console . log ( `Failed to kill visualvm process PID=${ visualvmPid } : ${ err } ` )
301
+ }
299
302
}
300
303
// Wait for a while to have all resources released before the final cleanup
301
304
await new Promise ( f => setTimeout ( f , 3000 ) ) ;
0 commit comments