Files
dify_market_manager_gui/force-kill-processes.js
2025-07-22 17:53:26 +08:00

73 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { execSync } = require('child_process')
console.log('=== 强制清理所有相关进程 ===')
function killProcesses() {
try {
// 查找所有相关进程
console.log('正在查找相关进程...')
const processes = [
'龙岗区百千万AI智能体共创平台.exe',
'dify-market-manager-gui.exe',
'electron.exe'
]
for (const processName of processes) {
try {
console.log(`\n检查进程: ${processName}`)
// 查找进程
const findResult = execSync(`tasklist /FI "IMAGENAME eq ${processName}" /FO CSV /NH`, {
encoding: 'utf8',
stdio: 'pipe'
})
if (findResult.includes(processName)) {
console.log(`找到进程: ${processName}`)
console.log(findResult)
// 终止进程
console.log(`正在终止进程: ${processName}`)
const killResult = execSync(`taskkill /F /IM "${processName}"`, {
encoding: 'utf8',
stdio: 'pipe'
})
console.log(`终止结果: ${killResult}`)
} else {
console.log(`未找到进程: ${processName}`)
}
} catch (error) {
if (error.message.includes('找不到')) {
console.log(`未找到进程: ${processName}`)
} else {
console.log(`处理进程 ${processName} 时出错:`, error.message)
}
}
}
// 等待一下,然后再次检查
setTimeout(() => {
console.log('\n=== 最终检查 ===')
try {
const finalCheck = execSync('tasklist /FI "IMAGENAME eq 龙岗区百千万AI智能体共创平台.exe" /FO CSV /NH', {
encoding: 'utf8'
})
console.log('剩余进程:')
console.log(finalCheck)
} catch (error) {
console.log('✅ 所有相关进程已清理完成')
}
}, 2000)
} catch (error) {
console.log('清理进程时出错:', error.message)
}
}
// 执行清理
killProcesses()
console.log('\n清理完成现在可以重新启动应用了。')