BlueGit

blue-star danique-bot

Files

danique-bot / node_modules / phantom-bridge / index.js

index.js

Import template
timfa Tim · pushed by timfa · 4 years ago
c788ad20 History
index.js 598 B Download Raw
1'use strict';
2var path = require('path');
3var spawn = require('child_process').spawn;
4var phantomjs = require('phantomjs-prebuilt').path;
5
6module.exports = function (file, args) {
7 if (!phantomjs) {
8 var err = new Error('The automatic install of PhantomJS seems to have failed.\nTry installing it manually: http://phantomjs.org/download.html');
9 err.noStack = true;
10 throw err;
11 }
12
13 args = [path.resolve(file)].concat(args).sort(function (a, b) {
14 // move flags to the beginning to please phantoms sucky argument parsing
15 return /^--/.test(b) ? 1 : 0;
16 });
17
18 return spawn(phantomjs, args);
19};