mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
close chokidar watcher before quit
This commit is contained in:
parent
b6c2eb6478
commit
14a34d33dd
1 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import win from './config/windows';
|
|||
import {cfgPath, cfgDir} from './config/paths';
|
||||
import {getColorMap} from './utils/colors';
|
||||
import {parsedConfig, configOptions} from '../lib/config';
|
||||
import {app} from 'electron';
|
||||
|
||||
const watchers: Function[] = [];
|
||||
let cfg: parsedConfig = {} as any;
|
||||
|
|
@ -54,6 +55,15 @@ const _watch = () => {
|
|||
_watcher.on('error', (error) => {
|
||||
console.error('error watching config', error);
|
||||
});
|
||||
|
||||
app.on('before-quit', (e) => {
|
||||
if (Object.keys(_watcher.getWatched()).length > 0) {
|
||||
e.preventDefault();
|
||||
_watcher.close().then(() => {
|
||||
app.quit();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const subscribe = (fn: Function) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue