I'm looking for a command like Ruby's kernel 'exec' but for Node.js. Any thoughts?
2 Answers
I took the advice of @phs and built a native Node.js module. A bit of details can be found here. Github source here.
You can use it like so:
npm install kexec
var kexec = require('kexec'); kexec("your_process with args here"); 1 Comment
ELLIOTTCABLE
Trying to decide if I can afford the time to patch this for Windows support. (It's clearly possible, both Ruby's
exec() and Python's execv() are cross-platform.)If you only care about posix platforms you could craft a small module in C and drop down to exec.
For some pointers on how you might do that, first realize that node is a framework that runs on top of v8, and then take a look at this or perhaps this.
3 Comments
JP Richardson
Awesome. Any tutorials on how I can do this?
phs
@JPRichardson You're looking at getting dirty with v8 extensions. I've updated the answer with a few links to get started.
JP Richardson
Thanks, I gave you an upvote as I didn't think of this as an option previously.
child_process.execis not satisfactory.