1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-06 00:13:33 +00:00

1. Fixed execv(e)

2. Fixed service.restart() for OpenRC
This commit is contained in:
Bryan Roe
2021-01-29 10:13:37 -08:00
parent 434cc0e66b
commit c3872d6ec8
4 changed files with 93 additions and 32 deletions

View File

@@ -595,7 +595,19 @@ duk_ret_t ILibDuktape_ChildProcess_execve(duk_context *ctx)
duk_pop(ctx); // [WCHAR_ARRAY][obj][array]
}
}
#ifndef WIN32
//
// We must close all open descriptors first, since the "new" process will have no idea about any that are still open
//
duk_eval_string(ctx, "require('util-descriptors').getOpenDescriptors();"); // [array]
while (duk_get_length(ctx, -1) > 0)
{
duk_array_pop(ctx, -1); // [array][fd]
close(duk_get_int(ctx, -1)); duk_pop(ctx); // [array]
}
execve(path, (char**)args, (char**)env);
return(ILibDuktape_Error(ctx, "_execve() returned error: %d ", errno));
#else