-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (27 loc) · 804 Bytes
/
index.js
File metadata and controls
33 lines (27 loc) · 804 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
33
// debugger
const debug = require('debug')('service')
// managers
const Launchd = require('./lib/manager/launchd')
const Systemd = require('./lib/manager/systemd')
const Nssm = require('./lib/manager/nssm')
const platform = process.env.PLATFORM || process.platform
let Service
if (platform === 'darwin') {
Service = Launchd
} else if (platform === 'linux') {
Service = Systemd
} else if (platform === 'win32') {
Service = Nssm
} else {
throw new Error('Unsupported platform ' + platform)
}
// check supported
if (!Service.supported()) {
throw new Error('Service manager ' + Service.manager + ' not supported')
}
// expose guessed service class
exports = module.exports = Service
// expose individual service managers
exports.Launchd = Launchd
exports.Systemd = Systemd
exports.Nssm = Nssm