Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var found = []
for (var i = 0, l = pathEnv.length; i < l; i ++) {
var pathPart = pathEnv[i]
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
pathPart = pathPart.slice(1, -1)
var p = path.join(pathPart, cmd)
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
p = cmd.slice(0, 2) + p
}
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
var cur = p + pathExt[j]
var is
try {
is = isexe.sync(cur, { pathExt: pathExtExe })
if (is) {
if (opt.all)
found.push(cur)
else
return cur
}
} catch (ex) {}
}
}
if (opt.all && found.length)
return found
if (opt.nothrow)
return null
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
const found = []
for (let i = 0; i < pathEnv.length; i ++) {
const ppRaw = pathEnv[i]
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
const pCmd = path.join(pathPart, cmd)
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
: pCmd
for (let j = 0; j < pathExt.length; j ++) {
const cur = p + pathExt[j]
try {
const is = isexe.sync(cur, { pathExt: pathExtExe })
if (is) {
if (opt.all)
found.push(cur)
else
return cur
}
} catch (ex) {}
}
}
if (opt.all && found.length)
return found
if (opt.nothrow)
return null
var found = []
for (var i = 0, l = pathEnv.length; i < l; i ++) {
var pathPart = pathEnv[i]
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
pathPart = pathPart.slice(1, -1)
var p = path.join(pathPart, cmd)
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
p = cmd.slice(0, 2) + p
}
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
var cur = p + pathExt[j]
var is
try {
is = isexe.sync(cur, { pathExt: pathExtExe })
if (is) {
if (opt.all)
found.push(cur)
else
return cur
}
} catch (ex) {}
}
}
if (opt.all && found.length)
return found
throw getNotFoundError(cmd)
}
var found = []
for (var i = 0, l = pathEnv.length; i < l; i ++) {
var pathPart = pathEnv[i]
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
pathPart = pathPart.slice(1, -1)
var p = path.join(pathPart, cmd)
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
p = cmd.slice(0, 2) + p
}
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
var cur = p + pathExt[j]
var is
try {
is = isexe.sync(cur, { pathExt: pathExtExe })
if (is) {
if (opt.all)
found.push(cur)
else
return cur
}
} catch (ex) {}
}
}
if (opt.all && found.length)
return found
throw getNotFoundError(cmd)
}
...(options['test-arg']),
]
tap.spawn(node, args, opt, file)
} else if (/\.jsx$|\.tsx?$|\.[mc]?js$/.test(file)) {
debug('js file', file)
const args = [
...(options.esm ? ['-r', esm] : []),
...options['node-arg'],
file,
...options['test-arg']
]
tap.spawn(node, args, opt, file)
} else if (/\.tap$/.test(file)) {
debug('tap file', file)
tap.spawn('cat', [file], opt, file)
} else if (isexe.sync(options.files[i])) {
debug('executable', file)
tap.spawn(options.files[i], options['test-arg'], opt, file)
} else {
debug('not a test file', file)
}
}
}
if (doStdin)
tap.stdin()
debug('scheduled all files for execution')
}
var found = []
for (var i = 0, l = pathEnv.length; i < l; i ++) {
var pathPart = pathEnv[i]
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
pathPart = pathPart.slice(1, -1)
var p = path.join(pathPart, cmd)
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
p = cmd.slice(0, 2) + p
}
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
var cur = p + pathExt[j]
var is
try {
is = isexe.sync(cur, { pathExt: pathExtExe })
if (is) {
if (opt.all)
found.push(cur)
else
return cur
}
} catch (ex) {}
}
}
if (opt.all && found.length)
return found
throw getNotFoundError(cmd)
}