签出用反了

release-2.0.1
cute-omega 2025-11-25 13:58:07 +08:00
parent 4c316db5b9
commit 4539e352a5
4 changed files with 3 additions and 52 deletions

View File

@ -102,17 +102,11 @@ jobs:
- name: npm run electron (auto-exit after 30min)
run: |
echo "======================================================================";
echo "cd packages/gui";
echo "--------------------";
cd packages/gui;
dir || ls -lah;
echo "======================================================================";
echo "npm run electron with timeout";
echo "--------------------";
if [ "$RUNNER_OS" = "Windows" ]; then
powershell ../../scripts/run-electron-with-timeout.ps1
powershell _script/run-electron-with-timeout.ps1
else
bash ../../scripts/run-electron-with-timeout.sh
bash _script/run-electron-with-timeout.sh
fi

View File

@ -14,7 +14,7 @@ while ($timer.Elapsed.TotalSeconds -lt $TimeoutSeconds) {
Write-Host "❌ 程序运行不正常"
exit 1
}
Start-Sleep -Seconds 1
Start-Sleep -Seconds 60
}
if (!$process.HasExited) {

View File

@ -1,43 +0,0 @@
#!/usr/bin/env node
import { spawn } from 'node:child_process'
import path from 'node:path'
const timeoutMs = Number(process.env.ELECTRON_TIMEOUT_MS ?? 30 * 60 * 1000) // 30 minutes
const workdir = path.resolve(process.argv[2] ?? 'packages/gui')
const command = process.platform === 'win32' ? 'npm.cmd' : 'npm'
console.log(`Starting npm run electron in ${workdir} with ${timeoutMs / 60000} minute timeout...`)
const child = spawn(command, ['run', 'electron'], {
cwd: workdir,
stdio: 'inherit',
})
let timedOut = false
const timer = setTimeout(() => {
timedOut = true
console.log(`\n⏱ Electron run completed ${timeoutMs / 60000} minutes without error, terminating...`)
child.kill('SIGTERM')
setTimeout(() => {
if (!child.killed)
child.kill('SIGKILL')
}, 5000)
}, timeoutMs)
child.on('exit', (code, signal) => {
clearTimeout(timer)
if (timedOut) {
console.log('✅ 程序运行正常')
process.exit(0)
} else {
console.log('❌ 程序运行不正常')
process.exit(1)
}
})
child.on('error', (err) => {
clearTimeout(timer)
console.error('Failed to start electron:', err)
process.exit(1)
})