Skip to content

Instantly share code, notes, and snippets.

@michaellopez
Last active January 2, 2016 23:08
Show Gist options
  • Select an option

  • Save michaellopez/8374002 to your computer and use it in GitHub Desktop.

Select an option

Save michaellopez/8374002 to your computer and use it in GitHub Desktop.
Handle scientific e notation hash in Grunt
if (grunt.config.get('config.changeSet') === Infinity) {
grunt.log.writeln('ChangeSet was interpreted as Infinity. Trying to manually parse command line arguments.'.yellow);
grunt.log.writeln('A single "e" in the changeset is interpreted with scientific notation, sometimes causing "Infinity".'.yellow);
process.argv.forEach(function(val) {
if (val.indexOf('hgid') >= 0) {
var changeSet = val.split('=');
if (changeSet[1]) {
grunt.config.set('config.changeSet', changeSet[1]);
return false; // Break loop
} else {
grunt.fail.warn('Changeset was interpreted as Infinity. Fallback failed.');
}
}
return true; // Continue loop
});
}
grunt.log.writeln('Using changeset: ' + grunt.config.get('config.changeSet'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment