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

Commit

Permalink
fix for win py2.x / py3.x
Browse files Browse the repository at this point in the history
It looks like py3.x on win doesn't require '\r' to properly split the end of the lines but py2.x does. This should work for both cases plus osx and *nix
  • Loading branch information
przemyslawpluta committed Apr 8, 2014
1 parent 540ee03 commit 472a8db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ function call(video, args, options, callback) {
args.push('http://www.youtube.com/watch?v=' + id);
}

var opt = [file, args, ''];
var opt = [file, args];

if (isWin) { opt = ['python', [file].concat(args), '\r']; }
if (isWin) { opt = ['python', [file].concat(args)]; }

// Call youtube-dl.
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(opt[2] + '\n');
var data = stdout.trim().split(/\r?\n/);
callback(null, data);
});

Expand Down

0 comments on commit 472a8db

Please sign in to comment.