修复了关闭系统无需鉴权的问题

This commit is contained in:
2023-12-15 10:33:19 +00:00
parent da2c61089b
commit 467e6e2a61
3 changed files with 38 additions and 10 deletions

View File

@ -113,12 +113,6 @@ io.on('connection', async (socket) => {
console.log('message: ' + msg);
const substrings = msg.trim().split('\n')[0].split(' ');
const head=substrings[0];
if(head[1]=='S')
{
backend.stdin.write("#ShutDownSystem\n");
sleep(1000);
process.exit(0);
}
const session_token=substrings[1];
if(head[1]=='O')
{
@ -146,6 +140,17 @@ io.on('connection', async (socket) => {
});
});
backend.on('exit', (code, signal) => {
if (code !== null) {
console.log(`子进程退出,退出码: ${code}`);
} else if (signal !== null) {
console.log(`子进程被信号中断,信号: ${signal}`);
} else {
console.log('子进程退出');
}
process.exit(0);
});
server.listen(3000, () => {
console.log('server running at http://localhost:3000');
});