mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
termio/exec: use bash instead of zsh for shell launching
This commit is contained in:
@ -878,10 +878,15 @@ const Subprocess = struct {
|
|||||||
// "-q" flag to login(1).
|
// "-q" flag to login(1).
|
||||||
//
|
//
|
||||||
// So to get all the behaviors we want, we specify "-l" but
|
// So to get all the behaviors we want, we specify "-l" but
|
||||||
// execute "zsh" (which is built-in to macOS). We then use
|
// execute "bash" (which is built-in to macOS). We then use
|
||||||
// the zsh builtin "exec" to replace the process with a login
|
// the bash builtin "exec" to replace the process with a login
|
||||||
// shell ("-l" on exec) with the command we really want.
|
// shell ("-l" on exec) with the command we really want.
|
||||||
//
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
// To figure out a lot of this logic I read the login.c
|
// To figure out a lot of this logic I read the login.c
|
||||||
// source code in the OSS distribution Apple provides for
|
// source code in the OSS distribution Apple provides for
|
||||||
// macOS.
|
// macOS.
|
||||||
@ -890,8 +895,15 @@ const Subprocess = struct {
|
|||||||
try args.append("/usr/bin/login");
|
try args.append("/usr/bin/login");
|
||||||
if (hush) try args.append("-q");
|
if (hush) try args.append("-q");
|
||||||
try args.append("-flp");
|
try args.append("-flp");
|
||||||
|
|
||||||
|
// We execute bash with "--noprofile --norc" so that it doesn't
|
||||||
|
// load startup files so that (1) our shell integration doesn't
|
||||||
|
// break and (2) user configuration doesn't mess this process
|
||||||
|
// up.
|
||||||
try args.append(username);
|
try args.append(username);
|
||||||
try args.append("/bin/sh");
|
try args.append("/bin/bash");
|
||||||
|
try args.append("--noprofile");
|
||||||
|
try args.append("--norc");
|
||||||
try args.append("-c");
|
try args.append("-c");
|
||||||
try args.append(cmd);
|
try args.append(cmd);
|
||||||
break :args try args.toOwnedSlice();
|
break :args try args.toOwnedSlice();
|
||||||
|
Reference in New Issue
Block a user