Gets the absolute path for a `cmd`.
@param {String} cmd - e.g. `codesign`.
@param {Function} fn - Callback which receives `(err, binPath)`.
@return {void}
161841
function getBinPath(cmd, fn) {
  which(cmd, function(err, bin) {
    if (err) {
      return fn(err);
    }

    fs.exists(bin, function(exists) {
      if (!exists) {
        return fn(new Error(format(
          'Expected file for `%s` does not exist at `%s`',
          cmd, bin)));
      }
      fn(null, bin);
    });
  });
}
1048322
function getBinPath(packageInstallFolder, binName) {
    const binFolderPath = path.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin');
    const resolvedBinName = (os.platform() === 'win32') ? `${binName}.cmd` : binName;
    return path.resolve(binFolderPath, resolvedBinName);
}
1316587
public static function detectCmdLocationWithWhich($cmd) : string
    {
        $bin = '';
        // on nx systems use 'which' command.
        if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
            $command = trim(`which $cmd`);
            $bin     = self::getExecutable($command);
        }
        return $bin;

    }
669349
def abspath(self, path):
        """"""

        def getcwd():
            """Return the current working directory."""
            # pylint: disable=undefined-variable
            if IS_PY2 and isinstance(path, text_type):
                return self.os.getcwdu()
            elif not IS_PY2 and isinstance(path, bytes):
                return self.os.getcwdb()
            else:
                return self.os.getcwd()

        path = make_string_path(path)
        sep = self.filesystem._path_separator(path)
        altsep = self.filesystem._alternative_path_separator(path)
        if not self.isabs(path):
            path = self.join(getcwd(), path)
        elif (self.filesystem.is_windows_fs and
              path.startswith(sep) or altsep is not None and
              path.startswith(altsep)):
            cwd = getcwd()
            if self.filesystem._starts_with_drive_letter(cwd):
                path = self.join(cwd[:2], path)
        return self.normpath(path)
1360741
function (cmd) {
    var cmdName = dotty.get(cmd, this.definitions.command.name);

    if (!cmdName) {
      var err = new Error('command has no command name in ' + this.definitions.command.name);
      debug(err);
      throw err;
    }

    var version = 0;
    if (!!this.definitions.command.version) {
      version = dotty.get(cmd, this.definitions.command.version);
    }

    var command = this.getCommand(cmdName, version);
    if (!command) {
      var aggregateId = dotty.get(cmd, this.definitions.command.aggregateId);
      var aggregateName = this.name;
      var contextName = this.context.name;

      return [{
        context: contextName,
        aggregate: aggregateName,
        aggregateId: aggregateId
      }];
    }

    return command.getLoadInfo(cmd);
  }
972066
function initCommand(fis) {
    var cmdConfName = 'modules.commands';
    var cmds = fis.get(cmdConfName, []);
    // builtin cmds: 'init', 'install', 'release', 'server', 'inspect'
    ['list', 'search', 'uninstall', 'update', 'test', 'publish'].forEach(function (item) {
        if (cmds.indexOf(item) === -1) {
            cmds.push(item);
        }
    });

    fis.set(cmdConfName, cmds);
}
1192621
function(fn) {
        var m = fnr.exec( fn.toString() );
        var args = m[1].split(/\s*,\s*/);
        var body = m[2].trim();
        fnr.lastIndex = 0;
        return {args:args, body:body};
    }
1035836
function (cmd, callback) {
    if (!cmd || !_.isObject(cmd)) {
      var err = new Error('Please pass a valid command!');
      debug(err);
      throw err;
    }

    if (!callback || !_.isFunction(callback)) {
      var err = new Error('Please pass a valid callback!');
      debug(err);
      throw err;
    }

    var target = this.getTargetInformation(cmd);

    var commandHandler = this.tree.getCommandHandler(target);

    // if (!commandHandler) {
    //   commandHandler = this.tree.getCommandHandlerByOldTarget(target);
    // }

    if (!commandHandler) {
      var err = new Error('No command handler found for ' + target.name);
      debug(err);
      return callback(err);
    }

    if (!this.commandBumper) {
      return commandHandler.handle(cmd, callback);
    }

    var key = target.context + target.aggregate + target.aggregateId + dotty.get(cmd, this.definition.id);

    this.commandBumper.add(key, function (err, added) {
      if (err) {
        return callback(err);
      }

      if (!added) {
        return callback(new DuplicateCommandError('Command already seen!'));
      }

      commandHandler.handle(cmd, callback);
    });
  }
1115068
function ensurePathsExist(pathsList, cb) {
	async.eachLimit(pathsList, 10, function (pathItem, callback) {
		var absolutePath = path.resolve(pathItem);
		fs.stat(absolutePath, function (error, stats) {
			if (error) {
				return callback(new Error('Path does not exist: ' + absolutePath));
			}

			if (!stats.isDirectory()) {
				return callback(new Error('Path is not a directory: ' + absolutePath));
			}

			return callback();
		});
	}, cb);
}
602361
def get_executable_fullpath(name, dirname=None):
        # type: (AnyStr, Optional[AnyStr]) -> Optional[AnyStr]
        """"""
        if name is None:
            return None
        if is_string(name):
            name = str(name)
        else:
            raise RuntimeError('The input function name or path must be string!')
        if dirname is not None:  # check the given path first
            dirname = os.path.abspath(dirname)
            fpth = dirname + os.sep + name
            if os.path.isfile(fpth):
                return fpth
        # If dirname is not specified, check the env then.
        if sysstr == 'Windows':
            findout = UtilClass.run_command('where %s' % name)
        else:
            findout = UtilClass.run_command('which %s' % name)
        if not findout or len(findout) == 0:
            print("%s is not included in the env path" % name)
            exit(-1)
        first_path = findout[0].split('\n')[0]
        if os.path.exists(first_path):
            return first_path
        return None
951840
function (filePath)
    {
        if (0 === filePath.indexOf(process.cwd()))
        {
            filePath = path.relative(process.cwd(), filePath);
        }

        if (0 !== filePath.indexOf("./") && 0 !== filePath.indexOf("/"))
        {
            filePath = "./" + filePath;
        }

        return filePath;
    }
523010
function getCommand(commandName) {
    return _.find(commands, function (command) {
      return _.includes(command.aliases, commandName);
    });
  }
31807
public static function detectCmdLocationInPaths($cmd, array $paths) : string
    {
        foreach ($paths as $path) {
            $command = $path . DIRECTORY_SEPARATOR . $cmd;
            $bin     = self::getExecutable($command);
            if (null !== $bin) {
                return $bin;
            }
        }
        return '';
    }
557891
def get_absolute_path(*args):
    """"""
    directory = os.path.dirname(os.path.abspath(__file__))
    return os.path.join(directory, *args)
107605
function browserify (cmd, args) {
  console.log(cmd, args.join(" "));
  childProcess.fork(require.resolve(cmd + "/bin/cmd"), args.slice());
}
49836
function cmd_RETR($fd, $cmd)
    {
        $user = $this->getUser($fd);
        $ftpsock = $this->getUserSock($user);
        if (($file = $this->getFile($user, $cmd[1])) != false)
        {
            $this->send($fd, "150 Connecting to client");
            if ($fp = fopen($file, "r"))
            {
                while (!feof($fp))
                {
                    $cont = fread($fp, 1024);
                    if (!fwrite($ftpsock, $cont)) break;
                }
                if (fclose($fp) and $this->closeUserSock($user))
                {
                    $this->send($fd, "226 File successfully transferred");
                }
                else
                {
                    $this->send($fd, "550 Error during file-transfer");
                }
            }
            else
            {
                $this->send($fd, "550 Can't open " . $cmd[1] . ": Permission denied");
            }
        }
        else
        {
            $this->send($fd, "550 Can't open " . $cmd[1] . ": No such file or directory");
        }
    }
233323
function (cmd) {
			return self.alreadyProcessedTraces[cmd.modelElement.path()] && self.alreadyProcessedTraces[cmd.modelElement.path()][cmd.toString()];
		}