add a few checks for safety

This commit is contained in:
ansuz 2020-03-20 10:54:01 -04:00
parent dc840c2a70
commit 31c7cecaf9
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ var channelExists = function (filepath, cb) {
};
const destroyStream = function (stream) {
stream.close();
if (!stream) { return; }
try { stream.close(); } catch (err) { console.error(err); }
setTimeout(function () {
try { stream.destroy(); } catch (err) { console.log(err); }
}, 5000);