gulp-angular-protractor/web-driver.js
function (callback, verbose, startOptions) {
            log(PLUGIN_NAME + ' - Webdriver standalone server will be started');

            let callbackWasCalled = false;
            let logOutput = true;
            let command;
            let seleniumPid = null;

            function _interceptLogData(data) {
                let dataString = data.toString();

                if (logOutput && verbose) {
                    log(dataString);
                }

                if (dataString.indexOf(WEB_DRIVER_LOG_STARTED_NEW) >= 0 || dataString.indexOf(WEB_DRIVER_LOG_STARTED) >= 0) {
                    log(PLUGIN_NAME + ' - Webdriver standalone server is started');
                    callbackWasCalled = true;
                    logOutput = false;
                    callback();

                } else if (dataString.indexOf(WEB_DRIVER_LOG_STOPPED) >= 0) {
                    logOutput = true;

                    if (verbose) {
                        log(dataString);
                    }

                } else if (dataString.indexOf(SELENIUM_PID) >= 0) {
                    seleniumPid = parseInt(dataString.split(SELENIUM_PID)[1].substr(1).trim(), 10);
                    log(PLUGIN_NAME + ' - Webdriver standalone server PID is detected:' + seleniumPid);
                }
            }

            command = childProcess.spawn(
                COMMAND_RELATIVE_PATH + WEB_DRIVER_COMMAND,
                [WEB_DRIVER_START_COMMAND].concat(startOptions && startOptions.args ? startOptions.args : []),
                {
                    'cwd': protractorDirToUse
                }
            );

            command.once('close', function (errorCode) {
                log(PLUGIN_NAME + ' - Webdriver standalone server will be closed');

                if (!callbackWasCalled) {
                    callback(errorCode);
                }
            });

            command.stderr.on('data', _interceptLogData);
            command.stdout.on('data', _interceptLogData);

            return function () {
                if (seleniumPid) {
                    process.kill(seleniumPid, 'SIGINT');
                }
            };
        }
function (callback, verbose, startOptions) {
            log(PLUGIN_NAME + ' - Webdriver standalone server will be started');

            let callbackWasCalled = false;
            let logOutput = true;
            let command;
            let seleniumPid = null;

            function _interceptLogData(data) {
                let dataString = data.toString();

                if (logOutput && verbose) {
                    log(dataString);
                }

                if (dataString.indexOf(WEB_DRIVER_LOG_STARTED_NEW) >= 0 || dataString.indexOf(WEB_DRIVER_LOG_STARTED) >= 0) {
                    log(PLUGIN_NAME + ' - Webdriver standalone server is started');
                    callbackWasCalled = true;
                    logOutput = false;
                    callback();

                } else if (dataString.indexOf(WEB_DRIVER_LOG_STOPPED) >= 0) {
                    logOutput = true;

                    if (verbose) {
                        log(dataString);
                    }

                } else if (dataString.indexOf(SELENIUM_PID) >= 0) {
                    seleniumPid = parseInt(dataString.split(SELENIUM_PID)[1].substr(1).trim(), 10);
                    log(PLUGIN_NAME + ' - Webdriver standalone server PID is detected:' + seleniumPid);
                }
            }

            command = childProcess.spawn(
                COMMAND_RELATIVE_PATH + WEB_DRIVER_COMMAND,
                [WEB_DRIVER_START_COMMAND].concat(startOptions && startOptions.args ? startOptions.args : []),
                {
                    'cwd': protractorDirToUse
                }
            );

            command.once('close', function (errorCode) {
                log(PLUGIN_NAME + ' - Webdriver standalone server will be closed');

                if (!callbackWasCalled) {
                    callback(errorCode);
                }
            });

            command.stderr.on('data', _interceptLogData);
            command.stdout.on('data', _interceptLogData);

            return function () {
                if (seleniumPid) {
                    process.kill(seleniumPid, 'SIGINT');
                }
            };
        }
function ( callback , verbose , startOptions ) { log ( PLUGIN_NAME + ' - Webdriver standalone server will be started' ) ; let callbackWasCalled = false ; let logOutput = true ; let command ; let seleniumPid = null ; function _interceptLogData ( data ) { let dataString = data . toString ( ) ; if ( logOutput && verbose ) { log ( dataString ) ; } if ( dataString . indexOf ( WEB_DRIVER_LOG_STARTED_NEW ) >= 0 || dataString . indexOf ( WEB_DRIVER_LOG_STARTED ) >= 0 ) { log ( PLUGIN_NAME + ' - Webdriver standalone server is started' ) ; callbackWasCalled = true ; logOutput = false ; callback ( ) ; } else if ( dataString . indexOf ( WEB_DRIVER_LOG_STOPPED ) >= 0 ) { logOutput = true ; if ( verbose ) { log ( dataString ) ; } } else if ( dataString . indexOf ( SELENIUM_PID ) >= 0 ) { seleniumPid = parseInt ( dataString . split ( SELENIUM_PID ) [ 1 ] . substr ( 1 ) . trim ( ) , 10 ) ; log ( PLUGIN_NAME + ' - Webdriver standalone server PID is detected:' + seleniumPid ) ; } } command = childProcess . spawn ( COMMAND_RELATIVE_PATH + WEB_DRIVER_COMMAND , [ WEB_DRIVER_START_COMMAND ] . concat ( startOptions && startOptions . args ? startOptions . args : [ ] ) , { 'cwd' : protractorDirToUse } ) ; command . once ( 'close' , function ( errorCode ) { log ( PLUGIN_NAME + ' - Webdriver standalone server will be closed' ) ; if ( ! callbackWasCalled ) { callback ( errorCode ) ; } } ) ; command . stderr . on ( 'data' , _interceptLogData ) ; command . stdout . on ( 'data' , _interceptLogData ) ; return function ( ) { if ( seleniumPid ) { process . kill ( seleniumPid , 'SIGINT' ) ; } } ; }
@callback WebDriverService~stopServer
 
Start the WebDriver server

@method
@static
@param {Function} callback
@param {boolean} [verbose=true]
@param {Object} [startOptions]
@returns {WebDriverService~stopServer} Function to stop the server
@callback WebDriverService~stopServer Start the WebDriver server