Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

always call the callback and return #27

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 7 additions & 11 deletions index.js
Expand Up @@ -77,24 +77,20 @@ function start_server(opts, callback) {
if (opts.exit_callback) {
opts.exit_callback(child.status);
}
callback(child.status);
return child.status;
}

// need to catch child pid
var child_pid_match = child.stdout.toString().match(/forked process:\s+(\d+)/i);
child_pid = child_pid_match[1];

// if mongod started, spawn killer
if (child.status === 0) {
} else { // mongod started
// need to catch child pid
var child_pid_match = child.stdout.toString().match(/forked process:\s+(\d+)/i);
child_pid = child_pid_match[1];

// spawn a mongo killer
debug('starting mongokiller.js, ppid:%d\tmongod pid:%d', process.pid, child_pid);
var killer = proc.spawn("node", [path.join(__dirname, "binjs", "mongokiller.js"), process.pid, child_pid], {
stdio: 'ignore',
detached: true
});
killer.unref();
}

callback(child.status);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need an IF statement to check if the callback is indeed a function.

return child.status;
}
}
Expand Down