maybe I misunderstood you, but ..
PHP Code:
execute_aCD()
{
exec_async_checkdone();
}
aExecute_getID()
{
id = level.sv_dataVar["tech"]["exec_count"];
level.sv_dataVar["tech"]["exec_count"]++;
return id;
}
aExecute_callback(result, id)
{
level.exec_buffer[id] = result;
level notify("aExecute_" + id);
}
aExecute(query)
{
printf("%\n", query);
id = aExecute_getID();
exec_async_create(query, ::aExecute_callback, id);
level waittill("aExecute_" + id);
result = level.exec_buffer[id];
return result;
}
aExecute_(query)
{
printf("%\n", query);
exec_async_create_nosave(query);
}
server init:
PHP Code:
level.sv_dataVar["tech"]["exec_count"] = 0;
level.exec_buffer = [];
call:
PHP Code:
result = aExecute("php somework.php " + arg1 + " " + arg2);
if (!isDefined(result))
{
//execution error
}
if (result[0] == "ERROR")
{
//script executed but returned error
}
this is for "undefined" if for some reason the script was not executed:
https://github.com/damage99/libcod/b..._exec.cpp#L104
it helped me with problem:
the script was not executed (lack of RAM in my cases)
all other errors (invalid arguments, wrong args types, etc.) can be processed already in the script itself (.sh, .php etc.)