Skip to main content

Module session

Module session 

Source
Expand description

Session management: writes --cwd-file on normal exit.

A subprocess cannot change its parent shell’s working directory. Trail’s “shell continues in the directory currently displayed” behaviour requires a shell-side wrapper function that reads the file Trail writes here and calls cd on its contents.

On normal exit (q / Quit action) Trail calls write_cwd_file to record state.cwd in the path supplied by --cwd-file. On cancellation (Ctrl-c / Esc-driven quit) the function is not called, so the file is never written and the shell wrapper falls back to the original directory.

Structs§

RecentDirs
Persisted recent directories store.

Functions§

write_cwd_file
Writes cwd as a UTF-8 string to cwd_file_path.