Skip to content

Commit bab2bd1

Browse files
committed
feat: electron试运行脚本移除 PowerShell 和 Bash 实现,改为使用 Node.js 实现
1 parent c669cad commit bab2bd1

File tree

4 files changed

+5
-70
lines changed

4 files changed

+5
-70
lines changed

.github/workflows/npm-run-electron.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ jobs:
103103
- name: npm run electron (auto-exit after 30min)
104104
run: |
105105
echo "======================================================================";
106-
echo "npm run electron with timeout";
106+
echo "electron with timeout";
107107
echo "--------------------";
108-
if [ "$RUNNER_OS" = "Windows" ]; then
109-
powershell _script/run-electron-with-timeout.ps1
110-
else
111-
bash _script/run-electron-with-timeout.sh
112-
fi
108+
node _script/run-electron-with-timeout.js packages/gui 5

_script/run-electron-with-timeout.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import { spawn } from 'node:child_process'
33
import path from 'node:path'
44

5-
const timeoutMs = Number(process.env.ELECTRON_TIMEOUT_MS ?? 30 * 60 * 1000) // 30 minutes
6-
const workdir = path.resolve(process.argv[2] ?? 'packages/gui')
75
const command = process.platform === 'win32' ? 'npm.cmd' : 'npm'
6+
const workdir = path.resolve(process.argv[2] ?? 'packages/gui')
7+
const timeoutMs = Number(process.argv[3] ?? 5) * 60 * 1000 // 5 minutes
88

99
console.log(`Starting npm run electron in ${workdir} with ${timeoutMs / 60000} minute timeout...`)
1010

@@ -31,7 +31,7 @@ child.on('exit', (code, signal) => {
3131
console.log('✅ 程序运行正常')
3232
process.exit(0)
3333
} else {
34-
console.log('❌ 程序运行不正常')
34+
console.log(`❌ 程序运行不正常 (code: ${code}, signal: ${signal})`)
3535
process.exit(1)
3636
}
3737
})

_script/run-electron-with-timeout.ps1

Lines changed: 0 additions & 29 deletions
This file was deleted.

_script/run-electron-with-timeout.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)