[tools] winetest: Make sure the cron script releases the lock once done.

Francois Gouget fgouget at codeweavers.com
Thu Feb 18 18:37:03 CST 2021


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 winetest/winetest.cron | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/winetest/winetest.cron b/winetest/winetest.cron
index 7418f9ec9..611901380 100755
--- a/winetest/winetest.cron
+++ b/winetest/winetest.cron
@@ -31,6 +31,10 @@ then
     exit 1
 fi
 lock="/tmp/winetest.lock"
+cleanup()
+{
+    rm -f "$lock"
+}
 
 # expiration age (in days) before results get archived
 expire=120
@@ -38,6 +42,7 @@ expire=120
 if [ ! -f "$lock" ]
 then
     touch "$lock"
+    trap cleanup EXIT
     cd "$workdir"
 
     refresh_index=""
@@ -87,6 +92,4 @@ then
     # remove old queue files
     find queue -maxdepth 1 -mtime +30 -name "err*" -print0 | xargs -0 rm -rf
     find queue -maxdepth 1 -mtime +30 -name "CGI*" -print0 | xargs -0 rm -f
-
-    rm "$lock"
 fi
-- 
2.20.1




More information about the wine-devel mailing list