forked from mongodb-js/mongodb-prebuilt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
22 lines (19 loc) · 802 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';
var proc = require('child_process');
var path = require('path');
module.exports = function(exec_name) {
var debug = require('debug')('mongodb-prebuilt:' + exec_name);
var exec_path = require('./index').bin_path();
var exec_bin = path.resolve(exec_path, exec_name);
debug("exec_path: %s", exec_bin);
var child = proc.spawn(exec_bin, process.argv.slice(2), {stdio: 'inherit'});
child.on('close', function (code) {
process.exit(code);
});
var mongokiller = path.resolve(exec_path, '../../../binjs', 'mongokiller.js');
var monitor_child = proc.spawn(
mongokiller,
[process.pid, child.pid],
{stdio: 'inherit', detached: false}
);
}