mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-18 01:03:14 +00:00
Fixed bug with os.hostname()
This commit is contained in:
@@ -1594,8 +1594,14 @@ duk_ret_t ILibDuktape_ScriptContainer_OS_networkInterfaces(duk_context *ctx)
|
|||||||
duk_ret_t ILibDuktape_ScriptContainer_OS_hostname(duk_context *ctx)
|
duk_ret_t ILibDuktape_ScriptContainer_OS_hostname(duk_context *ctx)
|
||||||
{
|
{
|
||||||
char name[1024];
|
char name[1024];
|
||||||
int len = gethostname(name, (int)sizeof(name));
|
if (gethostname(name, (int)sizeof(name)) == 0)
|
||||||
duk_push_lstring(ctx, name, len);
|
{
|
||||||
|
duk_push_string(ctx, name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
duk_push_string(ctx, "");
|
||||||
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
void ILibDuktape_ScriptContainer_OS_Push(duk_context *ctx, void *chain)
|
void ILibDuktape_ScriptContainer_OS_Push(duk_context *ctx, void *chain)
|
||||||
|
|||||||
Reference in New Issue
Block a user