Invoke trapexit after removing the pid, in case of exn in the trapexit fn

This commit is contained in:
Tony Garnock-Jones 2014-08-25 16:11:25 -07:00
parent 440c91b4d7
commit 1b3b355fea
1 changed files with 3 additions and 3 deletions

View File

@ -179,11 +179,11 @@ World.prototype.kill = function (pid, exn) {
console.log("Process exited", pid, exn);
}
var p = this.processTable[pid];
if (p && p.behavior.trapexit) {
this.asChild(pid, function () { return p.behavior.trapexit(exn); });
}
delete this.processTable[pid];
if (p) {
if (p.behavior.trapexit) {
this.asChild(pid, function () { return p.behavior.trapexit(exn); }, true);
}
if (exn) {
p.exitReason = exn;
this.tombstones[pid] = p;