mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Use a more tolerant regexp when splitting lines.
This commit is contained in:
@@ -59,7 +59,7 @@ GitFsResolver.refs = function (source) {
|
||||
refs = stdout.toString()
|
||||
.trim() // Trim trailing and leading spaces
|
||||
.replace(/[\t ]+/g, ' ') // Standardize spaces (some git versions make tabs, other spaces)
|
||||
.split(/\r?\n/); // Split lines into an array
|
||||
.split(/[\r\n]+/); // Split lines into an array
|
||||
|
||||
// Update the refs with the actual refs
|
||||
this._cache.refs.set(source, refs);
|
||||
|
||||
@@ -51,18 +51,21 @@ GitRemoteResolver.prototype._checkout = function () {
|
||||
promise = cmd('git', ['clone', this._source, '-b', branch, '--depth', 1, '--progress', '.'], { cwd: this._tempDir });
|
||||
}
|
||||
|
||||
// Start reporting progress after 8 seconds
|
||||
// Start reporting progress after a few seconds
|
||||
timer = setTimeout(function () {
|
||||
promise.progress(function (data) {
|
||||
var lines = data.split(/\r?\n/);
|
||||
var lines = data.split(/[\r\n]+/);
|
||||
|
||||
lines.forEach(function (line) {
|
||||
if (/\d{1,3}\%/.test(line)) {
|
||||
that._logger.info('progress', data);
|
||||
// TODO: There are some strange chars that appear
|
||||
// once in a while (\u001b[K)
|
||||
// Trim also those?
|
||||
that._logger.info('progress', line.trim());
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 8000);
|
||||
}, 10000);
|
||||
|
||||
return promise
|
||||
// Clear timer at the end
|
||||
@@ -91,7 +94,7 @@ GitRemoteResolver.refs = function (source) {
|
||||
refs = stdout.toString()
|
||||
.trim() // Trim trailing and leading spaces
|
||||
.replace(/[\t ]+/g, ' ') // Standardize spaces (some git versions make tabs, other spaces)
|
||||
.split(/\r?\n/); // Split lines into an array
|
||||
.split(/[\r\n]+/); // Split lines into an array
|
||||
|
||||
// Update the refs with the actual refs
|
||||
this._cache.refs.set(source, refs);
|
||||
|
||||
Reference in New Issue
Block a user