diff options
author | Christian Hesse <mail@eworm.de> | 2021-06-27 20:40:22 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-06-30 11:13:50 +0200 |
commit | 301ad4b3e570a362dd8f7b7fe4448d7638803509 (patch) | |
tree | 22179d9bae869acfc29e910e54e5797426f7f6e1 /global-functions | |
parent | 89f8dc712001872783c8b3be7208bc1d726a12dd (diff) |
global-functions: $ScriptLock: allow to return...
... with true instead of breaking with error.
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/global-functions b/global-functions index 63c0e21..d15d176 100644 --- a/global-functions +++ b/global-functions @@ -904,13 +904,18 @@ # lock script against multiple invocation :set ScriptLock do={ - :global LogPrintExit2; + :local Script [ :tostr $1 ]; + :local DoReturn $2; - :local Script [ :tostr $1 ]; + :global IfThenElse; + :global LogPrintExit2; :if ([ :len [ / system script job find where script=$Script ] ] > 1) do={ - $LogPrintExit2 info $0 ("Script " . $Script . " started more than once... Aborting.") true; + $LogPrintExit2 info $0 ("Script " . $Script . " started more than once... Aborting.") \ + [ $IfThenElse ($DoReturn = true) false true ]; + :return true; } + :return false; } # send notification via e-mail - expects at lease two string arguments |