From 19ccc54388f07efe8b62e8e8df37c3513e28d0af Mon Sep 17 00:00:00 2001 From: Przemyslaw Pluta Date: Fri, 14 Feb 2014 13:14:44 +0000 Subject: [PATCH] Fix - win handling getInfo & getFormats cleanup --- lib/youtube-dl.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/youtube-dl.js b/lib/youtube-dl.js index 36b9c22..c416316 100644 --- a/lib/youtube-dl.js +++ b/lib/youtube-dl.js @@ -156,22 +156,19 @@ function call(url, args, options, callback) { args = args.concat(util.parseOpts(options)); args.push(url); - var target = file; - var opt = args; + var opt = [file, args, '']; - if (isWin) { - target = 'python'; - opt = args; - } + if (isWin) { opt = ['python', [file].concat(args), '\r']; } // Call youtube-dl. - execFile(target, opt, function(err, stdout, stderr) { + execFile(opt[0], opt[1], function(err, stdout, stderr) { if (err) return callback(err); if (stderr) return callback(new Error(stderr.slice(7))); - var data = stdout.trim().split('\r\n'); + var data = stdout.trim().split(opt[2] + '\n'); callback(null, data); }); + }