src/cli/enforce-global.js
function getVersion() {
    // parse the version number
    try {
      // find the executable
      var resolvedPath = which.sync(whichExec)

      // grab the raw output
      var result = shell.exec(`"${resolvedPath}" ${versionCommand}`, { silent: true })
      var rawOut = ramda.trim(result.stdout || '')
      var rawErr = ramda.trim(result.stderr || '') // java -version does this... grr

      // assign the "right" one to raw
      var raw = rawOut
      if (ramda.isEmpty(raw)) {
        raw = rawErr
      }
      if (ramda.isEmpty(raw)) {
        raw = null
      }

      // and run it by the version matcher
      return versionMatcher(raw)
    } catch (err) {
      return null
    }
  }
function getVersion() {
    // parse the version number
    try {
      // find the executable
      var resolvedPath = which.sync(whichExec)

      // grab the raw output
      var result = shell.exec(`"${resolvedPath}" ${versionCommand}`, { silent: true })
      var rawOut = ramda.trim(result.stdout || '')
      var rawErr = ramda.trim(result.stderr || '') // java -version does this... grr

      // assign the "right" one to raw
      var raw = rawOut
      if (ramda.isEmpty(raw)) {
        raw = rawErr
      }
      if (ramda.isEmpty(raw)) {
        raw = null
      }

      // and run it by the version matcher
      return versionMatcher(raw)
    } catch (err) {
      return null
    }
  }
function getVersion ( ) { // parse the version number try { // find the executable var resolvedPath = which . sync ( whichExec ) // grab the raw output var result = shell . exec ( ` ${ resolvedPath } ${ versionCommand } ` , { silent : true } ) var rawOut = ramda . trim ( result . stdout || '' ) var rawErr = ramda . trim ( result . stderr || '' ) // java -version does this... grr // assign the "right" one to raw var raw = rawOut if ( ramda . isEmpty ( raw ) ) { raw = rawErr } if ( ramda . isEmpty ( raw ) ) { raw = null } // and run it by the version matcher return versionMatcher ( raw ) } catch ( err ) { return null } }
Gets the version from the global dependency.

@return {string} The version number or null.
Gets the version from the global dependency .