'use strict';

var puppeteer = require('puppeteer');
var exec = require('child_process').execFile;

var _require = require('../util/logger'),
    logger = _require.logger;

exports.launchChrome = function (url, remoteDebugPort) {
  url = url.replace(/[&*]/g, '\\&');
  var args = [url];
  if (remoteDebugPort > 0) {
    args.push('-remote-debugging-port=' + remoteDebugPort);
  }
  exec(puppeteer.executablePath(), args, function (err, data) {
    if (err) {
      logger.error(err);
    }
  });
};