Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore(version-info.js): ignore curl file write errors #14780

Merged
merged 2 commits into from
Jun 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/versions/version-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var _ = require('lodash');
var process = require('process');
// We are only interested in whether this environment variable exists, hence the !!
var NO_REMOTE_REQUESTS = !!process.env['NG1_BUILD_NO_REMOTE_VERSION_REQUESTS'];
var versionSource = NO_REMOTE_REQUESTS ? 'local' : 'remote';

var currentPackage, previousVersions, cdnVersion, gitRepoInfo;

Expand Down Expand Up @@ -149,10 +150,11 @@ var getCdnVersion = function() {
// Note: need to use shell.exec and curl here
// as version-infos returns its result synchronously...
var cdnResult = shell.exec('curl http://ajax.googleapis.com/ajax/libs/angularjs/' + version + '/angular.min.js ' +
'--head --write-out "%{http_code}" -o /dev/null -silent',
'--head --write-out "%{http_code}" -silent',
{silent: true});
if (cdnResult.code === 0) {
var statusCode = cdnResult.output.trim();
// --write-out appends its content to the general request response, so extract it
var statusCode = cdnResult.output.split('\n').pop().trim();
if (statusCode === '200') {
cdnVersion = version;
}
Expand Down Expand Up @@ -221,5 +223,6 @@ if (NO_REMOTE_REQUESTS) {
console.log(' - be aware that the generated docs may not have valid or the most recent version information.');
console.log('==============================================================================================');
}
console.log('CDN version:', cdnVersion.raw);
console.log('Current version:', exports.currentVersion.raw);

console.log('CDN version (' + versionSource + '):', cdnVersion ? cdnVersion.raw : 'No version found.');
console.log('Current version (' + versionSource + '):', exports.currentVersion.raw);