-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
executable file
·29 lines (23 loc) · 1.03 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
#!/usr/bin/env node
'use strict'
const { homedir } = require('os')
const { join } = require('path')
const { exitHandler, unexpectedError } = require('./lib/handlers')
const processManager = require('./lib/process-manager')
const output = require('./lib/output')
const { npm_lifecycle_script: npmLifeCycleScript } = process.env
const args = npmLifeCycleScript != null
? npmLifeCycleScript.split(' ').slice(-1)
: process.argv.slice(-1)
// Registering error and exit handlers
process.on('beforeExit', exitHandler)
process.on('SIGINT', exitHandler)
process.on('uncaughtException', unexpectedError)
process.on('unhandledRejection', unexpectedError)
if (!process.release.lts) {
output.error('nsolid-exec is compatible only with Node.js LTS versions')
process.exit(1)
}
processManager.start(process.release.lts.toLowerCase(), join(homedir(), '.nsolid-runtime'))
processManager.launchProcess([join(__dirname, 'lib', 'connection-checker.js')]) // Check the connection with the console
processManager.launchProcess(args) // Launch the user's process