()
| 85 | } |
| 86 | |
| 87 | async function main() { |
| 88 | await waitForBuildArtifacts() |
| 89 | await startElectronProcess() |
| 90 | |
| 91 | for (const filePath of watchedFiles) { |
| 92 | watchFile(filePath, { interval: 250 }, (current, previous) => { |
| 93 | if (current.mtimeMs !== previous.mtimeMs) { |
| 94 | scheduleRestart() |
| 95 | } |
| 96 | }) |
| 97 | } |
| 98 | |
| 99 | const cleanup = () => { |
| 100 | if (restartTimer) { |
| 101 | clearTimeout(restartTimer) |
| 102 | restartTimer = null |
| 103 | } |
| 104 | |
| 105 | for (const filePath of watchedFiles) { |
| 106 | unwatchFile(filePath) |
| 107 | } |
| 108 | |
| 109 | stopElectronProcess() |
| 110 | } |
| 111 | |
| 112 | process.once('SIGINT', () => { |
| 113 | cleanup() |
| 114 | process.exit(0) |
| 115 | }) |
| 116 | process.once('SIGTERM', () => { |
| 117 | cleanup() |
| 118 | process.exit(0) |
| 119 | }) |
| 120 | } |
| 121 | |
| 122 | void main().catch((error) => { |
| 123 | console.error(error) |
no test coverage detected