<commit_before>
var path = require('path'),
  spawn = require('child_process').spawn;

var env = process.platform;

module.exports = function(grunt) {

  grunt.registerTask('docs', 'grunt h5bp plugin documentation', function(target) {
    // long running process
    var cb = this.async();
    var config = {
      base: path.join(__dirname, '../docs'),
      port: grunt.option('port') || 3000,
      browser: grunt.config('browser') || grunt.option('browser') || ''
    };

    var browser = config.browser ? config.browser :
      env === 'win32' ? 'explorer' :
      env === 'darwin' ? 'open' :
      'google-chrome';

    var app = grunt.helper('serve', config);

    app.on('start', function() {
      var open = spawn(browser, ['http://localhost:' + config.port]);
      open.on('error', function(er) { console.error(er); });
      open.on('exit', function(code) {
        if(code) grunt.warn('Something bad happend', code);
      });
    });
  });

};<commit_msg>minor change to task doc, open browser and forget<commit_after>
var path = require('path'),
  spawn = require('child_process').spawn;

var env = process.platform;

module.exports = function(grunt) {

  grunt.registerTask('docs', 'grunt h5bp plugin documentation', function(target) {
    // long running process
    var cb = this.async();
    var config = {
      base: path.join(__dirname, '../docs'),
      port: grunt.option('port') || 3000,
      browser: grunt.config('browser') || grunt.option('browser') || ''
    };

    var browser = config.browser ? config.browser :
      env === 'win32' ? 'explorer' :
      env === 'darwin' ? 'open' :
      'google-chrome';

    var app = grunt.helper('serve', config);

    app.on('start', function() {
      // spawn and forget, would probably ends up with no browser opening
      // but output to console webserver url.
      spawn(browser, ['http://localhost:' + config.port]);
      // windows kinda werid on explorer, getting an error code even though everything is ok

    });
  });

};
{'fraction_non_alphanumeric': 0.17006464445549477, 'fraction_numerical': 0.0069617105917454, 'mean_word_length': 3.024, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6459290', 'n_tokens_mistral': 619, 'n_tokens_neox': 600, 'n_words': 159}