mirror of
https://github.com/lxsang/antd-tunnel-publishers
synced 2024-12-26 01:48:21 +01:00
fix: allow passing environment variable to subprocess from runner
All checks were successful
gitea-sync/antd-tunnel-publishers/pipeline/head This commit looks good
All checks were successful
gitea-sync/antd-tunnel-publishers/pipeline/head This commit looks good
This commit is contained in:
parent
426ccca404
commit
dd1ceec996
8
runner.c
8
runner.c
@ -14,7 +14,7 @@
|
|||||||
#define MODULE_NAME "runner"
|
#define MODULE_NAME "runner"
|
||||||
#define MAX_STR_LEN 255u
|
#define MAX_STR_LEN 255u
|
||||||
/** up to 20 arguments*/
|
/** up to 20 arguments*/
|
||||||
#define MAX_ARGC 10u
|
#define MAX_ARGC 64u
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -38,6 +38,10 @@ static void execute_command(list_t *plist)
|
|||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
ASSERT(cmd.name != NULL, "Invalid service handler (NULL)");
|
ASSERT(cmd.name != NULL, "Invalid service handler (NULL)");
|
||||||
|
for (int i=0; environ[i]!=NULL && cmd.n_envs < MAX_ARGC; i++) {
|
||||||
|
cmd.envs[cmd.n_envs] = environ[i];
|
||||||
|
cmd.n_envs++;
|
||||||
|
}
|
||||||
pid = fork();
|
pid = fork();
|
||||||
ASSERT(pid != -1, "Unable to fork: %s", strerror(errno));
|
ASSERT(pid != -1, "Unable to fork: %s", strerror(errno));
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
@ -97,6 +101,8 @@ static int ini_handle(void *user_data, const char *section, const char *name,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern char **environ;
|
||||||
|
|
||||||
int main(int argc, char const *argv[])
|
int main(int argc, char const *argv[])
|
||||||
{
|
{
|
||||||
const char *conf_file;
|
const char *conf_file;
|
||||||
|
Loading…
Reference in New Issue
Block a user