Skip to main content

open

Function open 

Source
pub fn open() -> Result<Box<dyn Shell>, ShellError>
Expand description

Opens the best available shell for this process.

Reads BACKEND_ENV_VAR: when it names a backend, that backend is opened and a failure is not fallen back from — someone who set the variable meant it, and quietly running on a different backend turns a debugging session into a wild goose chase. Otherwise the compiled-in backends are tried in preference order and the first one that connects wins.

§Errors

§Today

On Linux, Wayland is tried and then X11; CRCBL_SHELL=wayland or CRCBL_SHELL=x11 forces one of them. On Windows and on macOS there is one backend each and it is selected automatically — although the AppKit one requires the process’s main thread and returns ShellError::Backend naming that rule anywhere else, which is a failure this list falls through rather than one it hides. Every other target has only HeadlessShell, which is not auto-selected, so this returns ShellError::NoBackend there unless CRCBL_SHELL=headless is set — the honest answer for a build with no window-system backend in it.