git: don't use fs.watch

fixes #25175
This commit is contained in:
Joao Moreno
2017-05-10 10:56:50 +02:00
parent be127659e4
commit e707642a3c
2 changed files with 2 additions and 30 deletions

View File

@@ -1,23 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { EventEmitter, Event, Disposable } from 'vscode';
import * as fs from 'fs';
export interface FSEvent {
eventType: string;
filename: string;
}
export function watch(path: string): { event: Event<FSEvent>; disposable: Disposable; } {
const emitter = new EventEmitter<FSEvent>();
const event = emitter.event;
const watcher = fs.watch(path, (eventType, filename) => emitter.fire({ eventType, filename }));
const disposable = new Disposable(() => watcher.close());
return { event, disposable };
}