Confusing lua return codes from os.execute

147 Views Asked by At

I'm trying to run the following code in sas:

proc lua restart;
submit;
    local cmd = "&cmd."
    local ret_code = os.execute(cmd)
    sas.symput('ret_code', ret_code)
endsubmit;
run;

Macro variable cmd resolves to a command I want to run. When it is successful, i get return code equals to 1 (why not 0?). But when it's not, it resolves to a dot.

I'm confused, why am i getting such strange return values? How to get 0 if everything's fine and > 0 if something's wrong from lua script? I'm using linux os

0

There are 0 best solutions below