script /file and :resolve return values (/file solved)

Greetings!

Maybe it is just me, but the /file commands are not returning to the script (EDIT: on fail only). Is there a way I can get a return value instead of the script aborting?

Same with script command “:resolve” on V3.X. OK on success. Aborts script on fail. Several of us need a return value on fail. I did not even realize it was failing until someone else on the forum brought it to my attention.

UPDATE: I found the reason my scripts with /file commands were failing. You cannot embed the /file get and find commands. You must use the ‘find’ parameter assigned to a variable, then check it. If it is valid, then you can use that variable in other file commands. If you use this
:global filecontents [/file get [/file find name=test.txt] contents]
and the file does not exist, then the script will abort.

With this

:global files [/file find name=test.txt]
:if ([:len $files] > 0) do={
   :global filecontents [/file get $files contents]
} else={
   :log info "failed"
}

it seems to do ok.

:resolve still a problem

I suggest sending support a ticket on this one. I wouldn’t call it a bug, but it would sure prevent some in the future : )

I would call it a bug. Doesn’t really need a ticket from me. Someone else has sent one. Run this
:put [:resolve bad.yahoo.com]; :log info “Got to here”
If you see “Got to here” in your log, let me know.

The problem is that resolve returns generic error and script thinks that it encountered an error and stops.
In one of next versions we will add ability to catch those errors similar to try-catch.

OK with me. I can make do until fixed.

This “generic error”, is it being returned from the dns resolver to the script interpreter? Could that affect other dns calls to the resolver also? That is presuming there is only one routine that resolves dns in the OS, correct?