livery.workshop._shell¶
livery.workshop._shell ¶
The entered-shell entry: a fully configured interactive shell.
fm shell [kind] makes the target shell itself evaluate
fm -C=<root> --quiet env.emit <dialect> at its own startup,
injected through a dialect-specific rc mechanism. The completion
hook is a shell function that never survives an exec, so evaluating
the emission in a wrapper and exec'ing the target would lose it;
evaluated inside the target, environment and completion both land in
the final interactive shell. A cold checkout fails loudly inside the
opened shell: the emission's refusal prints to stderr, never a shell
that merely looks entered.
The launch decisions are data (shell_launch_plan answers
argv, environment, and rc files) so every branch tests as a plain
call; the task body only writes and execs them.
Classes:
| Name | Description |
|---|---|
ShellLaunch |
Everything needed to open the entered shell, as pure data. |
Functions:
| Name | Description |
|---|---|
default_kind |
The platform's interactive shell: |
shell_launch_plan |
The launch plan for an entered kind shell rooted at root. |
launch_shell |
Open the entered shell; never returns on POSIX, waits on Windows. |
shell_default |
Open an entered shell of kind (bash, zsh, or pwsh). |
shell_prepare |
Prepare an entered launch: write its rc files, answer its argv. |
Attributes:
| Name | Type | Description |
|---|---|---|
shell |
|
ShellLaunch
dataclass
¶
default_kind ¶
default_kind() -> str
The platform's interactive shell: $SHELL's basename, else pwsh/bash.
Source code in packages/workshop/src/livery/workshop/_shell.py
shell_launch_plan ¶
shell_launch_plan(kind: str, *, root: Path, tmp_dir: Path) -> ShellLaunch
The launch plan for an entered kind shell rooted at root.
bash takes the injection through --rcfile (which replaces
~/.bashrc, so the rc sources it first; /etc rc files
load regardless); zsh through a throwaway ZDOTDIR whose
.zshenv and .zshrc chain to the user's own (ZDOTDIR
resets to the home inside, so nested shells behave); pwsh
through -NoExit -Command with the user profile still
loading. cmd is refused: it has no startup file to inject, so a
launched cmd only inherits a cold caller and looks entered
without being entered; pwsh delivers the full contract on
Windows.
Source code in packages/workshop/src/livery/workshop/_shell.py
launch_shell ¶
launch_shell(kind: str = '') -> None
Open the entered shell; never returns on POSIX, waits on Windows.
POSIX execs, nothing left behind. Windows has no real exec, so the launcher waits and forwards the exit code: the console needs an owner.
Source code in packages/workshop/src/livery/workshop/_shell.py
shell_default ¶
Open an entered shell of kind (bash, zsh, or pwsh).
The launched shell evaluates fm env.emit at its own startup,
so environment, PATH, and completion land inside it. Bare picks
$SHELL's kind, pwsh on Windows.
Source code in packages/workshop/src/livery/workshop/_shell.py
shell_prepare ¶
Prepare an entered launch: write its rc files, answer its argv.
The handoff for a launcher that must not keep a resident Python:
the caller launches the argv itself. Writing the rc files here
is the job, not a side errand; an argv naming a missing rc opens
a shell that looks entered and is not. A plan that needs
environment variables (zsh's throwaway ZDOTDIR) is refused
rather than returned half-working.