| Total Complexity | 7 |
| Complexity/F | 1.75 |
| Lines of Code | 32 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | 'use strict'; |
||
| 2 | |||
| 3 | const |
||
| 4 | path = require('path'), |
||
| 5 | spawn = require('child_process').spawn, |
||
| 6 | phantomjs = require('phantomjs-prebuilt'); |
||
| 7 | |||
| 8 | exports.run = function(args, callback) { |
||
| 9 | args.unshift.apply(args, [path.join(__dirname, 'driver.js'), '--web-security=false', '--load-images=false', '--ignore-ssl-errors=yes', '--ssl-protocol=any']); |
||
| 10 | |||
| 11 | var driver = phantomjs.exec.apply(this, args); |
||
| 12 | |||
| 13 | driver.stdout.on('data', (data) => { |
||
| 14 | callback(`${data}`, null); |
||
| 15 | }); |
||
| 16 | |||
| 17 | driver.stderr.on('data', (data) => { |
||
| 18 | callback(null, `${data}`); |
||
| 19 | }); |
||
| 20 | } |
||
| 21 | |||
| 22 | if ( !module.parent ) { |
||
| 23 | exports.run(process.argv.slice(2), function(stdout, stderr) { |
||
| 24 | if ( stdout ) { |
||
| 25 | process.stdout.write(stdout); |
||
| 26 | } |
||
| 27 | |||
| 28 | if ( stderr ) { |
||
| 29 | process.stderr.write(stderr); |
||
| 30 | } |
||
| 31 | }); |
||
| 32 | } |
||
| 33 |