So I have an array of child processes in my NodeJs application. Now I have
cp_array[i].process.on("exit",exithandle(code,signal));
On each of them. The problem is I want to be able to access the process object of the process that exited in the exithandle. So if I'd put like cp_array[i].process.name="example" I'd be able to access my "example" string with process.name within the exithandle function.
You can access cp_array[i].process
through the this
keyword:
function exithandle(code, signal) {
var process = this;
return function() {
// Whatever
};
}