mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: reboot util
This commit is contained in:
parent
8134083419
commit
35dcb7b88b
@ -1,28 +1,28 @@
|
||||
import { exit } from "process";
|
||||
import { resolve } from "path";
|
||||
import { writeFile, writeFileSync } from "fs";
|
||||
async function rebootWithQuickLogin(uin: string) {
|
||||
import { exec } from "node:child_process";
|
||||
export async function rebootWithQuickLogin(uin: string) {
|
||||
let batScript = resolve(__dirname, './napcat.bat');
|
||||
let batUtf8Script = resolve(__dirname, './napcat-utf8.bat');
|
||||
let bashScript = resolve(__dirname, './napcat.sh');
|
||||
if (process.platform === 'win32') {
|
||||
writeFileSync(resolve(__dirname, './reboot-utf8.bat'), `
|
||||
@echo off
|
||||
timeout /t 5 /nobreak
|
||||
start /b /wait %~dp0\\napcat-utf8.bat -q ${uin}
|
||||
`);
|
||||
// 启动cmd执行脚本
|
||||
|
||||
exec(`timeout /t 5 /nobreak & ${batUtf8Script} -q ${uin}`);
|
||||
} else if (process.platform === 'linux') {
|
||||
writeFileSync(resolve(__dirname, './reboot.sh'), `
|
||||
#!/bin/bash
|
||||
timeout 5
|
||||
./napcat-utf8.sh -q ${uin}
|
||||
`);
|
||||
exec(`timeout 5 & ${bashScript} -q ${uin}`);
|
||||
// 启动bash执行脚本
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
export async function rebootWithNormolLogin() {
|
||||
let batScript = resolve(__dirname, './napcat.bat');
|
||||
let batUtf8Script = resolve(__dirname, './napcat-utf8.bat');
|
||||
let bashScript = resolve(__dirname, './napcat.sh');
|
||||
if (process.platform === 'win32') {
|
||||
exec(`timeout /t 5 /nobreak & ${batUtf8Script}`);
|
||||
} else if (process.platform === 'linux') {
|
||||
exec(`timeout 5 & ${bashScript}`);
|
||||
// 启动bash执行脚本
|
||||
|
||||
|
||||
|
||||
}
|
||||
exit(0);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user