Skip to content
Back to top
View this page
Edit this page

# xonsh.procs.executables

Interfaces to locate executable files on file system.

xonsh.procs.executables.clear_paths(paths)

  Remove duplicates and nonexistent directories from paths.

xonsh.procs.executables.get_paths(env=None)

  Return tuple with deduplicated and existent paths from `$PATH`.

xonsh.procs.executables.get_possible_names(name, env=None)

  Expand name to all possible variants based on PATHEXT.

  PATHEXT is a Windows convention containing extensions to be considered when searching for an executable file.

  Conserves order of any extensions found and gives precedence to the bare name.

xonsh.procs.executables.is_executable(filepath, check_file_exist=True)

  Check the file is executable in POSIX.

  Parameters:
    filepath str

      Path to file.

    check_file_exist bool

      If `False` do not check that file exists. This made to consistency with `is_executable_in_windows`.

xonsh.procs.executables.is_executable_in_posix(filepath, check_file_exist=True)

  Check the file is executable in POSIX.

  Parameters:
    filepath str

      Path to file.

    check_file_exist bool

      If `False` do not check that file exists. This made to consistency with `is_executable_in_windows`.

xonsh.procs.executables.is_executable_in_windows(filepath, check_file_exist=True, env=None)

  Check the file is executable in Windows.

  Parameters:
    filepath str

      Path to file.

    check_file_exist bool

      If `False` do not check that file exists. This helps to disable double checking in case the file already checked in upstream code. This is important for Windows where checking can take a long time.

xonsh.procs.executables.is_file(filepath)

  Check that `filepath` is file and exist.

xonsh.procs.executables.locate_executable(name, env=None)

  Search executable binary name in `$PATH` and return full path.

xonsh.procs.executables.locate_file(name, env=None, check_executable=False, use_pathext=False)

  Search file name in the current working directory and in `$PATH` and return full path.

xonsh.procs.executables.locate_file_in_path_env(name, env=None, check_executable=False, use_pathext=False)

  Search file name in `$PATH` and return full path.

  Compromise. There is no way to get case sensitive file name without listing all files. If the file name is `CaMeL.exe` and we found that `camel.EXE` exists there is no way to get back the case sensitive name. We don’t want to read the list of files in all `$PATH` directories because of performance reasons. So we’re ok to get existent but case insensitive (or different) result from resolver. May be in the future file systems as well as Python Path will be smarter to get the case sensitive name. The task for reading and returning case sensitive filename we give to completer in interactive mode with `commands_cache`.

xonsh.procs.executables.locate_relative_path(name, env=None, check_executable=False, use_pathext=False)

  Return absolute path by relative file path.

  We should not locate files without prefix (e.g. `"binfile"`) by security reasons like other shells. If directory has “binfile” it can be called only by providing prefix “./binfile” explicitly.