Skip to content

Instantly share code, notes, and snippets.

@hnakamur
Created September 12, 2012 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnakamur/3706154 to your computer and use it in GitHub Desktop.
Save hnakamur/3706154 to your computer and use it in GitHub Desktop.
parameters to script are not passed to workers.
I added debug prints.
```
static int pmain(lua_State *L) {
uv_loop_t *loop;
/*uv_timer_t gc_timer;*/
struct Smain *s = (struct Smain *)lua_touserdata(L, 1);
char **argv = s->argv;
int script;
int flags = 0;
globalL = L;
for (int i = 1; argv[i] != NULL; i++) {
printf("pmain worker_id=%s arg[%d]=%s\n", getenv("LEV_WORKER_ID"), i, argv[i]);
}
if (argv[0] && argv[0][0]) progname = argv[0];
```
The output was:
```
pmain worker_id=(null) arg[1]=tools/checkit
pmain worker_id=(null) arg[2]=tests/test-fs-stat.lua
pmain worker_id=1 arg[1]=tools/checkit
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment