-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
32 lines (24 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function updateProcessArgs () {
// fix freeze during debugging
process.execArgv = process.execArgv.filter(a => a == null || (!a.startsWith('--debug') && !a.startsWith('--inspect')))
}
module.exports = function (_options) {
var options = Object.assign({}, _options)
options.timeout = options.timeout || 10000
options.strategy = options.strategy || 'http-server'
if (options.strategy === 'http-server') {
updateProcessArgs()
return new (require('./lib/manager-servers.js'))(options)
}
if (options.strategy === 'dedicated-process') {
updateProcessArgs()
return new (require('./lib/manager-processes.js'))(options)
}
if (options.strategy === 'in-process') {
return new (require('./lib/in-process.js'))(options)
}
throw new Error('Unsupported scripts manager strategy: ' + options.strategy)
}
module.exports.ScriptManager = require('./lib/manager-servers.js')
module.exports.ScriptManagerOnHttpServers = module.exports.ScriptManager
module.exports.ScriptManagerOnProcesses = require('./lib/manager-processes.js')