global-functions: $ScriptFromTerminal: check multiple invocations...

... and return false.

We can not tell which job is us... So better safe than sorry.
This commit is contained in:
Christian Hesse 2024-04-11 13:57:11 +02:00
parent 6db3355858
commit 5f76c245b0

View file

@ -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;
}