-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (27 loc) 路 771 Bytes
/
Copy pathindex.js
File metadata and controls
27 lines (27 loc) 路 771 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
console.log('馃晵 Meleficent Loading. . . .')
import path, { dirname } from 'path'
import { spawn } from 'child_process'
import fs from 'fs'
import { fileURLToPath } from 'url'
process.on('uncaughtException', console.log)
const __dirname = dirname(fileURLToPath(import.meta.url));start();
function start() {
let args = [path.join(__dirname, 'main.js'), ...process.argv.slice(2)]
let p = spawn(process.argv[0], args, {
stdio: ['inherit', 'inherit', 'inherit', 'ipc']
})
.on('message', res => {
if (res == 'reset') {
console.log('Restarting...')
p.kill();
}
if (res == 'uptime') {
p.send(process.uptime())
}
})
.on('exit', code => {
console.error('Exited with code:', code)
p.kill();
start();
})
};