From da3920bd46ec18d71e9e33dba1689484406b5e34 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 3 Mar 2021 17:55:37 +0000 Subject: [PATCH] Wait for process to exit to avoid race with file deletion See gh-25457 --- .../boot/context/embedded/AbstractApplicationLauncher.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java index 508e9452d9b..38e711ad20f 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java @@ -64,6 +64,12 @@ abstract class AbstractApplicationLauncher implements BeforeEachCallback { void destroyProcess() { if (this.process != null) { this.process.destroy(); + try { + this.process.waitFor(); + } + catch (InterruptedException ex) { + Thread.currentThread().interrupt(); + } } }