From 22075e17e17ff80b3f4a4b7e42c41bffdb314980 Mon Sep 17 00:00:00 2001 From: Asger Gitz-Johansen Date: Thu, 29 Aug 2024 18:18:19 +0200 Subject: [PATCH] fix: remove PATH default env spawnp searches through PATH for you --- src/executor.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/executor.c b/src/executor.c index bee6bc3..dc53ca5 100644 --- a/src/executor.c +++ b/src/executor.c @@ -67,10 +67,9 @@ void add_env(strlist_node* root, const char* env) { } char** create_environment(const pipeline_event* const e, const char* pipeline_id) { - char* tmp = join("PATH=", getenv("PATH")); // TODO: consider removing PATH default, since it can be done as -e PATH + char* tmp = join("SCI_PIPELINE_NAME=", e->name); strlist_node* env = create_strlist_node(tmp); free(tmp); - add_joined_str(env, "SCI_PIPELINE_NAME=", e->name); add_joined_str(env, "SCI_PIPELINE_URL=", e->url); add_joined_str(env, "SCI_PIPELINE_TRIGGER=", e->trigger); add_joined_str(env, "SCI_PIPELINE_ID=", pipeline_id); @@ -113,7 +112,7 @@ void executor(void* data) { char arg0[PATH_MAX]; if(which(argv[0], arg0, PATH_MAX) == -1) goto end; - if(posix_spawn(&pid, arg0, &actions, NULL, argv, envp) != 0) { + if(posix_spawnp(&pid, arg0, &actions, NULL, argv, envp) != 0) { perror("posix_spawn"); goto end; // I know. The raptors have picked up the scent. I'll just have to mask it with more stinky code. }