Skip to content

Instantly share code, notes, and snippets.

@spullara
Created March 21, 2010 22:52
Show Gist options
  • Select an option

  • Save spullara/339617 to your computer and use it in GitHub Desktop.

Select an option

Save spullara/339617 to your computer and use it in GitHub Desktop.
diff --git a/src/node-supervisor.c b/src/node-supervisor.c
index 3e807d2..5569489 100644
--- a/src/node-supervisor.c
+++ b/src/node-supervisor.c
@@ -1,11 +1,16 @@
#define NODE_SUPERVISOR "/usr/local/lib/node-supervisor/cli-wrapper.js"
#include <unistd.h>
+#include <stdlib.h>
int main (int argc, char** argv) {
- return execl(
+ char** argv2 = malloc(sizeof(char*) * (2 + argc));
+ int i;
+ argv2[0] = "node";
+ argv2[1] = NODE_SUPERVISOR;
+ for (i = 0; i < argc; i++) {
+ argv2[i+2] = argv[i];
+ }
+ return execv(
NODE_BIN,
- "node",
- NODE_SUPERVISOR,
- argv[argc - 1],
- (char *)NULL
+ argv2
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment