Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
put try/catch around unlinking subtitle file
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Jan 12, 2015
1 parent 3cfa382 commit a3f5202
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,17 @@ vows.describe('download').addBatch({
},
'a video with subtitles': {
topic: function() {
fs.unlinkSync(path.join(__dirname, subtitleFile));
try {
fs.unlinkSync(path.join(__dirname, subtitleFile));
} catch (err) {}
ytdl.getSubs(video2, { lang: 'en', cwd: __dirname }, this.callback);
},

'subtitles were downloaded': function(err, files) {
if (err) throw err;
assert.equal(files[0], subtitleFile);
assert.isTrue(fs.existsSync(path.join(__dirname, subtitleFile)));
fs.unlinkSync(path.join(__dirname, subtitleFile));
}
}
}).export(module);

0 comments on commit a3f5202

Please sign in to comment.