'use strict';varpath=require('path');varwhich=require('which');varLRU=require('lru-cache');varcommandCache=newLRU({max:50,maxAge:30*1000});// Cache just for 30secfunctionresolveCommand(command,noExtension){varresolved;noExtension=!!noExtension;resolved=commandCache.get(command+'!'+noExtension);// Check if its resolved in the cacheif(commandCache.has(command)){returncommandCache.get(command);}try{resolved=!noExtension?which.sync(command):which.sync(command,{pathExt:path.delimiter+(process.env.PATHEXT||'')});}catch(e){/* empty */}commandCache.set(command+'!'+noExtension,resolved);returnresolved;}module.exports=resolveCommand;