fix(schematics): don't leak file descriptor in shared.ts/mtime

leak breaks IDE-TSLint integration. Fixes #403
This commit is contained in:
Maxim Kropotov 2018-04-06 17:29:39 +03:00 committed by Victor Savkin
parent 8ca8548886
commit aa1ff78c0e

View File

@ -234,7 +234,12 @@ function recursiveMtime(dirName: string) {
}
function mtime(f: string): number {
return fs.fstatSync(fs.openSync(f, 'r')).mtime.getTime();
let fd = fs.openSync(f, 'r');
try {
return fs.fstatSync(fd).mtime.getTime();
} finally {
fs.closeSync(fd);
}
}
function normalizePath(file: string): string {