Last active
January 2, 2016 23:08
-
-
Save michaellopez/8374002 to your computer and use it in GitHub Desktop.
Handle scientific e notation hash in Grunt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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