index.js
function () {
        var _this = this;

        console.info('INFO: creating tunnel to %s', this.proxyHost);

        this._tunnel = childProcess.spawn('ssh', this._buildSSHArgs());

        var cleanup = function () {
            _this._tunnel.stderr.removeAllListeners('data');
        };

        this._tunnel.stderr.on('data', function (data) {
            if (/success/.test(data)) {
                cleanup();
                return _this._resolveTunnel();
            }

            if (/failed/.test(data)) {
                cleanup();
                return _this._rejectTunnel();
            }
        });

        this._tunnel.on('exit', function (code, signal) {
            _this.emit('exit', code, signal);
        });

        this._tunnel.on('close', function (code, signal) {
            _this.emit('close', code, signal);
            return _this._closeTunnel(code);
        });

        this._tunnel.on('error', function () {
            return _this._rejectTunnel();
        });

        return _this._tunnelDeferred.promise.timeout(this._connectTimeout);
    }
function () {
        var _this = this;

        console.info('INFO: creating tunnel to %s', this.proxyHost);

        this._tunnel = childProcess.spawn('ssh', this._buildSSHArgs());

        var cleanup = function () {
            _this._tunnel.stderr.removeAllListeners('data');
        };

        this._tunnel.stderr.on('data', function (data) {
            if (/success/.test(data)) {
                cleanup();
                return _this._resolveTunnel();
            }

            if (/failed/.test(data)) {
                cleanup();
                return _this._rejectTunnel();
            }
        });

        this._tunnel.on('exit', function (code, signal) {
            _this.emit('exit', code, signal);
        });

        this._tunnel.on('close', function (code, signal) {
            _this.emit('close', code, signal);
            return _this._closeTunnel(code);
        });

        this._tunnel.on('error', function () {
            return _this._rejectTunnel();
        });

        return _this._tunnelDeferred.promise.timeout(this._connectTimeout);
    }
function ( ) { var _this = this ; console . info ( 'INFO: creating tunnel to %s' , this . proxyHost ) ; this . _tunnel = childProcess . spawn ( 'ssh' , this . _buildSSHArgs ( ) ) ; var cleanup = function ( ) { _this . _tunnel . stderr . removeAllListeners ( 'data' ) ; } ; this . _tunnel . stderr . on ( 'data' , function ( data ) { if ( / success / . test ( data ) ) { cleanup ( ) ; return _this . _resolveTunnel ( ) ; } if ( / failed / . test ( data ) ) { cleanup ( ) ; return _this . _rejectTunnel ( ) ; } } ) ; this . _tunnel . on ( 'exit' , function ( code , signal ) { _this . emit ( 'exit' , code , signal ) ; } ) ; this . _tunnel . on ( 'close' , function ( code , signal ) { _this . emit ( 'close' , code , signal ) ; return _this . _closeTunnel ( code ) ; } ) ; this . _tunnel . on ( 'error' , function ( ) { return _this . _rejectTunnel ( ) ; } ) ; return _this . _tunnelDeferred . promise . timeout ( this . _connectTimeout ) ; }
Tries to open ssh connection to remote server
@returns {Promise}
Tries to open ssh connection to remote server