Ind.ie is now Small Technology Foundation.
Commit 943f5a78 authored by Aral Balkan's avatar Aral Balkan

Now using cross-spawn-async for cross-platform compatibility.

parent 875ec03c
Pipeline #109 skipped
......@@ -32,7 +32,8 @@ module.exports = function electronHAR(url, options, callback) {
output: path,
user: options.user === Object(options.user) ?
options.user.name + ':' + options.user.password :
options.user,
null,
'debug': options['debug'] ? '' : null,
'user-agent': options['user-agent'] ? options['user-agent'] : null,
'limit-rate': options['limit-rate'] ? options['limit-rate'] : null,
landscape: options['landscape'] ? options['landscape'] : null
......@@ -43,18 +44,14 @@ module.exports = function electronHAR(url, options, callback) {
var args = [url].concat(
Object
.keys(config)
.reduce(function (n, flag) {
argv = ''
if (config[flag] !== undefined && config[flag] !== null ){
argv = flag.length === 1 ? '-' + flag : '--' + flag;
argv += ' ' + config[flag];
.reduce(function (argumentsList, flag) {
if ( config[flag] !== null) {
argumentsList.push ((flag.length === 1 ? '-' + flag : '--' + flag), config[flag]);
}
return argv;
return argumentsList;
}, [])
)
console.log('ARGS: ' + args);
// The callback for the spawned process.
var processCallback = function (err, stdout, stderr) {
if (err) {
......@@ -71,7 +68,7 @@ module.exports = function electronHAR(url, options, callback) {
}
try {
callback(null, JSON.parse(result));
callback(null, JSON.parse(data));
} catch (e) {
return callback(e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment