diff options
author | Christian Hesse <mail@eworm.de> | 2021-01-20 14:23:57 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-01-20 14:23:57 +0100 |
commit | c980699dd709a61d0409f0beb31a1dbfa58d995e (patch) | |
tree | 6f19351bd45670b70d2f46740148197589f5f993 /global-functions | |
parent | 11d43e9fe5d91269e0f7a4b0340a2e3d4dc9799f (diff) |
global-functions: add error handling
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/global-functions b/global-functions index a9fe6de..a46f35d 100644 --- a/global-functions +++ b/global-functions @@ -485,15 +485,23 @@ :set Dir [ $CleanFilePath $Dir ]; - :if ([ :len [ / file find where name=$Dir type="directory" ] ] = 0) do={ - :local WwwVal [ / ip service get www ]; - / ip service set www address=127.0.0.1/32 disabled=no port=80; + :if ([ :len [ / file find where name=$Dir type="directory" ] ] = 1) do={ + :return true; + } + + :local Return true; + :local WwwVal [ / ip service get www ]; + / ip service set www address=127.0.0.1/32 disabled=no port=80; + :do { / tool fetch http://127.0.0.1/ dst-path=($Dir . "/tmp"); $WaitForFile ($Dir . "/tmp"); / file remove ($Dir . "/tmp"); - / ip service set www address=($WwwVal->"address") \ - disabled=($WwwVal->"disabled") port=($WwwVal->"port"); + } on-error={ + :set Return false; } + / ip service set www address=($WwwVal->"address") \ + disabled=($WwwVal->"disabled") port=($WwwVal->"port"); + :return $Return; } # parse key value store |