From 5f76c245b016125f9e56d45bef381bae38731491 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 11 Apr 2024 13:57:11 +0200 Subject: global-functions: $ScriptFromTerminal: check multiple invocations... ... and return false. We can not tell which job is us... So better safe than sorry. --- global-functions.rsc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/global-functions.rsc b/global-functions.rsc index 25c248d..abb9e22 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -931,6 +931,11 @@ :local Script [ :tostr $1 ]; :global LogPrint; + :global ScriptLock; + + :if ([ $ScriptLock $Script ] = false) do={ + :return false; + } :foreach Job in=[ /system/script/job/find where script=$Script ] do={ :set Job [ /system/script/job/get $Job ]; @@ -942,8 +947,8 @@ :return true; } } - $LogPrint debug $0 ("Script " . $Script . " NOT started from terminal."); + $LogPrint debug $0 ("Script " . $Script . " NOT started from terminal."); :return false; } -- cgit v1.2.3-70-g09d2