Loom structured concurrency can help us with this. The blocking calls can be handled with lightweight Loom threads. And the structured concurrency helps us with error ...
TMPDIR should not be there. I think the OS 'injects' the variable into the child process. However I am not able to recreate this behaviour outside of java, ie in bash shell if I unset TMPDIR and start ...
import java.io.IOException; public class ProcessDemo { public static void main(String[] args) throws IOException { Process p = new ProcessBuilder("notepad.exe").start ...