asif-anwar opened a new issue, #849:
URL: https://github.com/apache/maven-surefire/issues/849
### Affected version
3.5.3
### Bug description
Hi,
I have this simple JVM shutdown hook,
```
public class JVMShutdownHook {
static {
Thread hook = new Thread(() -> {
System.out.println("***********************Sysout from
JVMShutdownHook***********************");
});
System.out.println("Register JVM Hook");
Runtime.getRuntime().addShutdownHook(hook);
}
}
```
It's registered in the `@BeforeAll` method
```
public class JVMHookApplicationTests {
@BeforeAll
public static final void initiateJVMHook() throws ClassNotFoundException
{
Class.forName("com.example.jvmHook.JVMShutdownHook");
}
@Test
public void simpleTest() {
assertEquals(6, 6);
}
}
```
The `sysout` from the JVM hook doesn't work if the `forkCount `is greater
than 0. The JVM hook gets called consistently, but printing to the standard
output doesn't always work (it works sometimes, but the behaviour is
inconsistent).
The problem started from Suefire version 3.0.0-M5. It works fine with
3.0.0-M4 and prior versions.
Here is a simple application showing this problem -
https://github.com/asif-anwar/jvm-hook
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]