mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-18 03:57:02 +08:00
实现数据库密钥设置页
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { execFile } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
const WINDOWS_WECHAT_IMAGES = ['Weixin.exe', 'WeChat.exe']
|
||||
|
||||
export async function isWindowsWechatRunning(): Promise<boolean> {
|
||||
if (process.platform !== 'win32') return false
|
||||
|
||||
for (const imageName of WINDOWS_WECHAT_IMAGES) {
|
||||
try {
|
||||
const { stdout } = await execFileAsync(
|
||||
'tasklist',
|
||||
['/FI', `IMAGENAME eq ${imageName}`, '/FO', 'CSV', '/NH'],
|
||||
{ windowsHide: true }
|
||||
)
|
||||
if (stdout.toLowerCase().includes(`"${imageName.toLowerCase()}"`)) return true
|
||||
} catch {
|
||||
// Try the other supported WeChat executable name.
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user