@@ -6,17 +6,8 @@ import {
6
6
HIDE_BROWSER , BROWSER_SIZE ,
7
7
} from '../privateConfig.js'
8
8
9
- let browser
10
-
11
- // TODO: On Windows, there is a long pause between the browser closing and "Closing browser..."
12
- // getting logged. Somehow CTRL+C stops Puppeteer browser before this function runs.
13
- // And why is there such a long pause?
9
+ // TODO: On Windows, there is a long pause between the browser closing and exiting the process.
14
10
const shutDown = async ( code = 0 ) => {
15
- if ( browser ) {
16
- logger . log ( '🏁 Closing browser...' )
17
- await browser . close ( ) // TODO: Node doesn't seem to wait for this.
18
- console . log ( 'why doesn\'t this show up?' )
19
- }
20
11
process . exit ( code )
21
12
}
22
13
@@ -33,14 +24,14 @@ process.on('exit', () => {
33
24
const start = async ( ) => {
34
25
logger . log ( '🚦 Launching browser...' )
35
26
const { height, width } = BROWSER_SIZE
36
- browser = await puppeteer . launch ( {
27
+ const browser = await puppeteer . launch ( {
37
28
headless : HIDE_BROWSER ,
38
29
defaultViewport : { width, height } ,
39
30
args : [ `--window-size=${ width } ,${ height } ` ]
40
31
} )
41
32
42
33
try {
43
- startChecking ( browser )
34
+ await startChecking ( browser )
44
35
} catch ( err ) {
45
36
logger . error ( '💥 App failure:' , err )
46
37
await shutDown ( 1 )
0 commit comments