Add quotes to user-agent in debug command line

This commit is contained in:
Gaël Métais
2015-01-15 12:19:25 +01:00
parent 34468198ec
commit 6521d24925
+11 -3
View File
@@ -1,6 +1,7 @@
var async = require('async');
var Q = require('q');
var ps = require('ps-node');
var path = require('path');
var debug = require('debug')('ylt:phantomaswrapper');
var phantomas = require('phantomas');
@@ -46,8 +47,8 @@ var PhantomasWrapper = function() {
'windowPerformance' // overriden
].join(','),
'include-dirs': [
'lib/tools/phantomas/custom_modules/core',
'lib/tools/phantomas/custom_modules/modules'
path.join(__dirname, 'custom_modules/core'),
path.join(__dirname, 'custom_modules/modules')
].join(',')
};
@@ -55,7 +56,14 @@ var PhantomasWrapper = function() {
debug('If you want to reproduce the phantomas task only, copy the following command line:');
var optionsString = '';
for (var opt in options) {
optionsString += ' ' + '--' + opt + '=' + options[opt];
var value = options[opt];
if ((typeof value === 'string' || value instanceof String) && value.indexOf(' ') >= 0) {
value = '"' + value + '"';
}
optionsString += ' ' + '--' + opt + '=' + value;
}
debug('node node_modules/phantomas/bin/phantomas.js --url=' + task.url + optionsString + ' --verbose');