lib/launchers/phantom-launcher.js
function (cfg, state, n) {
        cfg.args = cfg.args || {};
        var phantomPath = cfg.phantomPath;
        var controlScript = pathUtil.join(__dirname, '../browsers/phantomjs-control-script.js');

        var args = [];
        args.push(controlScript);
        args.push("--auto-exit");
        if (cfg.args.autoExitPolling) {
            args.push("--auto-exit-polling=" + cfg.args.autoExitPolling);
        }
        if (typeof n == "undefined") {
            n = Math.round(Math.random() * 1000) % 1000;
        }
        args.push("--instance-id=" + n);
        args.push(cfg.slaveURL);

        var phantomProcess = spawn(phantomPath, args, {
            stdio: "pipe"
        });
        if (cfg.pipeStdOut) {
            phantomProcess.stdout.pipe(process.stdout);
            phantomProcess.stderr.pipe(process.stderr);
        }
        if (cfg.onData) {
            phantomProcess.stdout.on("data", cfg.onData);
        }
        phantomProcess.on("exit", cfg.onExit || this.createPhantomExitCb(cfg, state, n).bind(this));
        phantomProcess.on("error", cfg.onError || this.createPhantomErrorCb(cfg, state, n).bind(this));
        return phantomProcess;
    }
function (cfg, state, n) {
        cfg.args = cfg.args || {};
        var phantomPath = cfg.phantomPath;
        var controlScript = pathUtil.join(__dirname, '../browsers/phantomjs-control-script.js');

        var args = [];
        args.push(controlScript);
        args.push("--auto-exit");
        if (cfg.args.autoExitPolling) {
            args.push("--auto-exit-polling=" + cfg.args.autoExitPolling);
        }
        if (typeof n == "undefined") {
            n = Math.round(Math.random() * 1000) % 1000;
        }
        args.push("--instance-id=" + n);
        args.push(cfg.slaveURL);

        var phantomProcess = spawn(phantomPath, args, {
            stdio: "pipe"
        });
        if (cfg.pipeStdOut) {
            phantomProcess.stdout.pipe(process.stdout);
            phantomProcess.stderr.pipe(process.stderr);
        }
        if (cfg.onData) {
            phantomProcess.stdout.on("data", cfg.onData);
        }
        phantomProcess.on("exit", cfg.onExit || this.createPhantomExitCb(cfg, state, n).bind(this));
        phantomProcess.on("error", cfg.onError || this.createPhantomErrorCb(cfg, state, n).bind(this));
        return phantomProcess;
    }
function ( cfg , state , n ) { cfg . args = cfg . args || { } ; var phantomPath = cfg . phantomPath ; var controlScript = pathUtil . join ( __dirname , '../browsers/phantomjs-control-script.js' ) ; var args = [ ] ; args . push ( controlScript ) ; args . push ( "--auto-exit" ) ; if ( cfg . args . autoExitPolling ) { args . push ( "--auto-exit-polling=" + cfg . args . autoExitPolling ) ; } if ( typeof n == "undefined" ) { n = Math . round ( Math . random ( ) * 1000 ) % 1000 ; } args . push ( "--instance-id=" + n ) ; args . push ( cfg . slaveURL ) ; var phantomProcess = spawn ( phantomPath , args , { stdio : "pipe" } ) ; if ( cfg . pipeStdOut ) { phantomProcess . stdout . pipe ( process . stdout ) ; phantomProcess . stderr . pipe ( process . stderr ) ; } if ( cfg . onData ) { phantomProcess . stdout . on ( "data" , cfg . onData ) ; } phantomProcess . on ( "exit" , cfg . onExit || this . createPhantomExitCb ( cfg , state , n ) . bind ( this ) ) ; phantomProcess . on ( "error" , cfg . onError || this . createPhantomErrorCb ( cfg , state , n ) . bind ( this ) ) ; return phantomProcess ; }
Starts PhantomJS child process with instance number `n` using `cfg.path` as PhantomJS path and connects it to
`cfg.slaveURL`
@param {Object} cfg
@param {Object} state
@param {Integer} n
Starts PhantomJS child process with instance number n using cfg . path as PhantomJS path and connects it to cfg . slaveURL