From a1e0f2f5f069a927661a9d4c6d9f86057d45ac1c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 11 Jan 2016 17:50:31 +0000 Subject: [PATCH] Update launch script to wait for pid to be written to pid file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the launch script would wait for the pid file to exist before continuing. This didn’t work 100% of the time as it left a window where the file had been created but the PID had not been written to it that could result in an incorrect report of the app failing to start. This commit updates the script to wait for the file to have a size greater than zero before continuing. This ensures that the pid has been written to the file before the pid is read from the file and used to check that the process is running. Closes gh-4923 --- .../org/springframework/boot/loader/tools/launch.script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script b/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script index 73a1137a86..d6778a46a3 100755 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script @@ -85,7 +85,7 @@ isRunning() { await_file() { end=$(date +%s) let "end+=10" - while [[ ! -f "$1" ]] + while [[ ! -s "$1" ]] do now=$(date +%s) if [[ $now -ge $end ]]; then