currently ProcessBuilder blocks jvm shutdown if processes have not finished at jvm shutdown:
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 21+
//DEPS io.smallrye.common:smallrye-common-process:2.20.0
import static io.smallrye.common.process.ProcessBuilder.*;
public class SmallRyeProcessShutdown {
public static void main(String[] args) {
var seconds = args.length == 0 ? 3 : Integer.parseInt(args[0]);
newBuilder("sleep", Integer.toString(seconds))
.whileRunning(process -> System.out.println("child pid: " + process.pid()))
.runAsync();
System.out.println("main() returning immediately; child sleeps for " + seconds + "s");
}
}
any reason why?
forces me to use other API's to kick off background jobs.
Thats sad :)
currently ProcessBuilder blocks jvm shutdown if processes have not finished at jvm shutdown:
any reason why?
forces me to use other API's to kick off background jobs.
Thats sad :)