Fixed issue where youtube-dl autoupdates broke if checkExistsWithTimeout failed the first time

This commit is contained in:
Isaac Abadi
2021-09-19 14:24:18 -04:00
parent f689609941
commit 33f23c3ca9

View File

@@ -837,7 +837,7 @@ async function checkExistsWithTimeout(filePath, timeout) {
fs.access(filePath, fs.constants.R_OK, function (err) {
if (!err) {
clearTimeout(timer);
watcher.close();
if (watcher) watcher.close();
resolve();
}
});
@@ -847,7 +847,7 @@ async function checkExistsWithTimeout(filePath, timeout) {
var watcher = fs.watch(dir, function (eventType, filename) {
if (eventType === 'rename' && filename === basename) {
clearTimeout(timer);
watcher.close();
if (watcher) watcher.close();
resolve();
}
});