mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-22 03:44:59 +02:00
global-functions: $FileGet: mitigate race with file properties
RouterOS is suffering a race condition, where a file exists, but its properties are not (yet) available. This is handled in $WaitForFile. This passes an interval of zero to $WaitForFile, as does not wait for the file to exist, but wants to avoid the race only.
This commit is contained in:
parent
b3dc8eb92a
commit
44f7417b7f
1 changed files with 6 additions and 0 deletions
|
@ -559,6 +559,12 @@
|
|||
:set FileGet do={
|
||||
:local FileName [ :tostr $1 ];
|
||||
|
||||
:global WaitForFile;
|
||||
|
||||
:if ([ $WaitForFile $FileName 0s ] = false) do={
|
||||
:return false;
|
||||
}
|
||||
|
||||
:local FileVal false;
|
||||
:do {
|
||||
:set FileVal [ /file/get $FileName ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue