@@ -16,7 +16,7 @@ import {
1616 stopProxyProcess ,
1717} from './main/proxy'
1818import { getSettings , initSettings } from './main/settings'
19- import { configureWatcher } from './main/watcher'
19+ import { closeWatcher , configureWatcher } from './main/watcher'
2020import { showWindow , trackWindowState } from './main/window'
2121import { BrowserServer } from './services/browser/server'
2222import { ProxyStatus } from './types'
@@ -193,10 +193,13 @@ app.whenReady().then(
193193// Quit when all windows are closed, except on macOS. There, it's common
194194// for applications and their menu bar to stay active until the user quits
195195// explicitly with Cmd + Q.
196- app . on ( 'window-all-closed' , ( ) => {
196+ app . on ( 'window-all-closed' , async ( ) => {
197197 if ( process . platform !== 'darwin' ) {
198198 app . quit ( )
199+ return
199200 }
201+
202+ await closeWatcher ( )
200203} )
201204
202205app . on ( 'activate' , async ( ) => {
@@ -209,10 +212,7 @@ app.on('activate', async () => {
209212} )
210213
211214app . on ( 'before-quit' , async ( ) => {
212- // stop watching files to avoid crash on exit
213215 k6StudioState . appShuttingDown = true
214- if ( k6StudioState . watcher ) {
215- await k6StudioState . watcher . close ( )
216- }
216+ await closeWatcher ( )
217217 return stopProxyProcess ( )
218218} )
0 commit comments