mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: try add reboot
This commit is contained in:
@@ -1,15 +1,28 @@
|
||||
import { exit } from "process";
|
||||
import { resolve } from "path";
|
||||
async function reboot() {
|
||||
import { writeFile, writeFileSync } from "fs";
|
||||
async function rebootWithQuickLogin(uin: string) {
|
||||
let batScript = resolve(__dirname, './napcat.bat');
|
||||
let batUtf8Script = resolve(__dirname, './napcat-utf8.bat');
|
||||
let bashScript = resolve(__dirname, './napcat.sh');
|
||||
//如果是win系统写出 5s延迟启动 默认batUtf8Script启动
|
||||
// 如果是linux系统写出 5s延迟启动 默认bashScript启动
|
||||
if (process.platform === 'win32') {
|
||||
// console.log('正在重启...');
|
||||
writeFileSync(resolve(__dirname, './reboot-utf8.bat'), `
|
||||
@echo off
|
||||
timeout /t 5 /nobreak
|
||||
start /b /wait %~dp0\\napcat-utf8.bat -q ${uin}
|
||||
`);
|
||||
// 启动cmd执行脚本
|
||||
|
||||
} else if (process.platform === 'linux') {
|
||||
//console.log('正在重启...');
|
||||
writeFileSync(resolve(__dirname, './reboot.sh'), `
|
||||
#!/bin/bash
|
||||
timeout 5
|
||||
./napcat-utf8.sh -q ${uin}
|
||||
`);
|
||||
// 启动bash执行脚本
|
||||
|
||||
|
||||
|
||||
}
|
||||
exit(0);
|
||||
}
|
Reference in New Issue
Block a user