spawn-wrap icon indicating copy to clipboard operation
spawn-wrap copied to clipboard

Support use of `-e` flag.

Open jamestalmage opened this issue 9 years ago • 3 comments

See: https://github.com/sindresorhus/ava/pull/815

Specifically: https://github.com/sindresorhus/ava/pull/815#issuecomment-218839461

This is because that PR makes use of the -e flag to fork a child process. Use of the -e flag causes spawn-wrap to disable wrapping that particular process.

It seems entirely possible that spawn-wrap could support the -e flag when detected by using the vm module, or maybe just simply by using eval.

jamestalmage avatar May 12 '16 19:05 jamestalmage

@jamestalmage I like this idea, definitely an edge-case that it would be nice for spawn-wrap to handle.

bcoe avatar May 13 '16 20:05 bcoe

So, what arguments would spawn-wrap pass to the wrapping script if node -e 'console.log("foo")' were invoked, for example?

This module knows nothing about what "wrapping" is involved. Probably the best solution would be to have some function that is passed into the call to spawnWrap() to mutate -e and -p code before passing to the node binary?

isaacs avatar Jul 26 '16 18:07 isaacs

Oh, but that won't work, will it? Because it has to survive different child processes, of course, duh. (I helped write this module, but forget how it works sometimes.)

Maybe just some option to say "invoke -e/-p arguments using the script as well, and trust that we'll handle it"?

isaacs avatar Jul 26 '16 18:07 isaacs