forked from pofider/node-script-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (24 loc) · 1015 Bytes
/
index.js
File metadata and controls
32 lines (24 loc) · 1015 Bytes
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'))
}
module.exports = function (_options) {
var options = _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')