Sha256: 7af7a68708317ab2b8743b44591d98ca6f5ca787e89e7c289154471fd2f67331

Contents?: true

Size: 1.16 KB

Versions: 186

Compression:

Stored size: 1.16 KB

Contents

var fs = require('fs')
var core
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
  core = require('./windows.js')
} else {
  core = require('./mode.js')
}

module.exports = isexe
isexe.sync = sync

function isexe (path, options, cb) {
  if (typeof options === 'function') {
    cb = options
    options = {}
  }

  if (!cb) {
    if (typeof Promise !== 'function') {
      throw new TypeError('callback not provided')
    }

    return new Promise(function (resolve, reject) {
      isexe(path, options || {}, function (er, is) {
        if (er) {
          reject(er)
        } else {
          resolve(is)
        }
      })
    })
  }

  core(path, options || {}, function (er, is) {
    // ignore EACCES because that just means we aren't allowed to run it
    if (er) {
      if (er.code === 'EACCES' || options && options.ignoreErrors) {
        er = null
        is = false
      }
    }
    cb(er, is)
  })
}

function sync (path, options) {
  // my kingdom for a filtered catch
  try {
    return core.sync(path, options || {})
  } catch (er) {
    if (options && options.ignoreErrors || er.code === 'EACCES') {
      return false
    } else {
      throw er
    }
  }
}

Version data entries

186 entries across 185 versions & 22 rubygems

Version Path
appmap-0.67.0 ./node_modules/isexe/index.js
disco_app-0.18.4 test/dummy/node_modules/isexe/index.js
disco_app-0.18.1 test/dummy/node_modules/isexe/index.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/isexe/index.js
disco_app-0.14.0 test/dummy/node_modules/isexe/index.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/isexe/index.js
appmap-0.66.2 ./node_modules/isexe/index.js
trusty-cms-5.0.1 node_modules/isexe/index.js
trusty-cms-4.3.5 node_modules/isexe/index.js
trusty-cms-5.0.0 node_modules/isexe/index.js
appmap-0.66.1 ./node_modules/isexe/index.js
appmap-0.66.0 ./node_modules/isexe/index.js
appmap-0.65.1 ./node_modules/isexe/index.js
appmap-0.65.0 ./node_modules/isexe/index.js
trusty-cms-4.3.4 node_modules/isexe/index.js
appmap-0.64.0 ./node_modules/isexe/index.js
appmap-0.63.0 ./node_modules/isexe/index.js
appmap-0.62.1 ./node_modules/isexe/index.js
trusty-cms-4.3.3 node_modules/isexe/index.js
trusty-cms-4.3.2 node_modules/isexe/index.js