(cmd, opt)
| 1189 | return cb ? step(0).then((res) => cb(null, res), cb) : step(0); |
| 1190 | }; |
| 1191 | var whichSync = (cmd, opt) => { |
| 1192 | opt = opt || {}; |
| 1193 | const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); |
| 1194 | const found = []; |
| 1195 | for (let i3 = 0; i3 < pathEnv.length; i3++) { |
| 1196 | const ppRaw = pathEnv[i3]; |
| 1197 | const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw; |
| 1198 | const pCmd = path5.join(pathPart, cmd); |
| 1199 | const p4 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; |
| 1200 | for (let j4 = 0; j4 < pathExt.length; j4++) { |
| 1201 | const cur = p4 + pathExt[j4]; |
| 1202 | try { |
| 1203 | const is = isexe.sync(cur, { pathExt: pathExtExe }); |
| 1204 | if (is) { |
| 1205 | if (opt.all) |
| 1206 | found.push(cur); |
| 1207 | else |
| 1208 | return cur; |
| 1209 | } |
| 1210 | } catch (ex) { |
| 1211 | } |
| 1212 | } |
| 1213 | } |
| 1214 | if (opt.all && found.length) |
| 1215 | return found; |
| 1216 | if (opt.nothrow) |
| 1217 | return null; |
| 1218 | throw getNotFoundError(cmd); |
| 1219 | }; |
| 1220 | module2.exports = which; |
| 1221 | which.sync = whichSync; |
| 1222 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…