Function: ghostel--macos-login-wrap
ghostel--macos-login-wrap is a natively compiled function defined in
ghostel-shell.el.
Signature
(ghostel--macos-login-wrap PROGRAM ARGS)
Documentation
Wrap PROGRAM/ARGS via /usr/bin/login to produce a macOS login shell.
Returns (LOGIN-PROGRAM . LOGIN-ARGS). Mirrors Ghostty's wrap:
/usr/bin/login [-q] -flp USER \
/bin/bash --noprofile --norc -c "exec -l PROGRAM [args]"
-q is added when ~/.hushlogin exists so login(1) suppresses
its banner. The bash builtin exec -l prepends - to argv[0]
of the final shell, which is what makes it a login shell.
PROGRAM and ARGS are shell-quoted into the -c command.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-shell.el
(defun ghostel--macos-login-wrap (program args)
"Wrap PROGRAM/ARGS via `/usr/bin/login' to produce a macOS login shell.
Returns (LOGIN-PROGRAM . LOGIN-ARGS). Mirrors Ghostty's wrap:
/usr/bin/login [-q] -flp USER \\
/bin/bash --noprofile --norc -c \"exec -l PROGRAM [args]\"
`-q' is added when `~/.hushlogin' exists so login(1) suppresses
its banner. The bash builtin `exec -l' prepends `-' to argv[0]
of the final shell, which is what makes it a login shell.
PROGRAM and ARGS are shell-quoted into the `-c' command."
(let* ((user (user-login-name))
(hush (file-exists-p (expand-file-name "~/.hushlogin")))
(quoted (mapconcat #'shell-quote-argument
(cons program args) " "))
(cmd (concat "exec -l " quoted))
;; Quote from Ghostty source:
;; We use "bash" instead of other shells that ship with macOS because
;; as of macOS Sonoma, we found with a microbenchmark that bash can
;; exec into the desired command ~2x faster than zsh.
(login-args (append (and hush '("-q"))
(list "-flp" user
"/bin/bash" "--noprofile" "--norc"
"-c" cmd))))
(cons "/usr/bin/login" login-args)))