add dependency-free node restart function as suggested by @KaKi87 https://github.com/RobinLinus/snapdrop/issues/515#issuecomment-1365403786
This commit is contained in:
parent
009fcd7745
commit
b691af71c0
1 changed files with 19 additions and 0 deletions
19
index.js
19
index.js
|
@ -26,6 +26,25 @@ process.on('unhandledRejection', (reason, promise) => {
|
||||||
console.log(reason)
|
console.log(reason)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
process.on(
|
||||||
|
'uncaughtException',
|
||||||
|
() => {
|
||||||
|
process.once(
|
||||||
|
'exit',
|
||||||
|
() => spawn(
|
||||||
|
process.argv.shift(),
|
||||||
|
process.argv,
|
||||||
|
{
|
||||||
|
cwd: process.cwd(),
|
||||||
|
detached: true,
|
||||||
|
stdio: 'inherit'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const RateLimit = require('express-rate-limit');
|
const RateLimit = require('express-rate-limit');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
|
Loading…
Reference in a new issue