()
| 78 | } |
| 79 | |
| 80 | static async kill(): Promise<void> { |
| 81 | return new Promise<void>((resolve, reject) => { |
| 82 | // Only kill a TTS process if it's still running |
| 83 | if (TTS.handle && TTS.handle.exitCode === null) { |
| 84 | // Use a timeout in case of zombie processes |
| 85 | let killTimeout: NodeJS.Timeout = setTimeout(() => { |
| 86 | reject(`Unable to kill TTS process: ${TTS.handle?.pid}`); |
| 87 | }, ttsKillTimeout); |
| 88 | |
| 89 | // Resolve our promise once the program has exited |
| 90 | TTS.handle.once("exit", () => { |
| 91 | clearTimeout(killTimeout); |
| 92 | TTS.handle = undefined; |
| 93 | resolve(); |
| 94 | }); |
| 95 | |
| 96 | TTS.handle.kill(); |
| 97 | } else { |
| 98 | resolve(); |
| 99 | } |
| 100 | }); |
| 101 | } |
| 102 | |
| 103 | static async setup() { |
| 104 | TTS.os = os.platform(); |
no outgoing calls
no test coverage detected