mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 13:01:14 +00:00
fix: reboot on win
This commit is contained in:
parent
1d4e307e96
commit
575debca63
@ -1,30 +1,37 @@
|
||||
import { exit } from "process";
|
||||
import { resolve } from "path";
|
||||
import { resolve } from "node:path";
|
||||
import { spawn } from "node:child_process";
|
||||
import { sleep } from "./helper";
|
||||
|
||||
import { pid, ppid, exit } from 'node: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') {
|
||||
let subProcess = spawn(`start ${batUtf8Script} -q ${uin}`, { detached: true, windowsHide: false, env: process.env, shell: true, stdio: 'ignore'});
|
||||
const subProcess = spawn(`start ${batUtf8Script} -q ${uin}`, { detached: true, windowsHide: false, env: process.env, shell: true, stdio: 'ignore' });
|
||||
subProcess.unref();
|
||||
// 子父进程一起送走 有点效果
|
||||
spawn('cmd /c taskkill /t /f /pid ' + pid.toString(), { detached: true, shell: true, stdio: 'ignore' });
|
||||
spawn('cmd /c taskkill /t /f /pid ' + ppid.toString(), { detached: true, shell: true, stdio: 'ignore' });
|
||||
} else if (process.platform === 'linux') {
|
||||
let subProcess = spawn(`${bashScript} -q ${uin}`, { detached: true, windowsHide: false, env: process.env, shell: true, stdio: 'ignore' });
|
||||
const subProcess = spawn(`${bashScript} -q ${uin}`, { detached: true, windowsHide: false, env: process.env, shell: true, stdio: 'ignore' });
|
||||
//还没兼容
|
||||
subProcess.unref();
|
||||
exit(0);
|
||||
}
|
||||
exit(0);
|
||||
//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') {
|
||||
spawn(`start ${batUtf8Script}`, { detached: true, windowsHide: false, env: process.env, shell: true });
|
||||
const subProcess = spawn(`start ${batUtf8Script} -q ${uin}`, { detached: true, windowsHide: false, env: process.env, shell: true, stdio: 'ignore' });
|
||||
subProcess.unref();
|
||||
// 子父进程一起送走 有点效果
|
||||
spawn('cmd /c taskkill /t /f /pid ' + pid.toString(), { detached: true, shell: true, stdio: 'ignore' });
|
||||
spawn('cmd /c taskkill /t /f /pid ' + ppid.toString(), { detached: true, shell: true, stdio: 'ignore' });
|
||||
} else if (process.platform === 'linux') {
|
||||
spawn(`${bashScript}`, { detached: true, windowsHide: false, env: process.env, shell: true });
|
||||
const subProcess = spawn(`${bashScript}`, { detached: true, windowsHide: false, env: process.env, shell: true });
|
||||
subProcess.unref();
|
||||
exit(0);
|
||||
}
|
||||
await sleep(500);
|
||||
exit(0);
|
||||
}
|
2
src/core
2
src/core
@ -1 +1 @@
|
||||
Subproject commit ca47eb4754fb676827297a3c4b10b5746e3a0d95
|
||||
Subproject commit 7575cec4fe527796a72126097e6feb6139799e27
|
Loading…
Reference in New Issue
Block a user