feat: add shell login option (#75)

Closes #72
This commit is contained in:
Paolo Ricciuti
2026-07-30 22:45:23 +07:00
committed by GitHub
parent 37182f7212
commit 2573ad73b4
10 changed files with 103 additions and 12 deletions
+8 -1
View File
@@ -82,6 +82,13 @@ func saveMode(mode string) {
_ = config.SaveState(state)
}
func shellArgs(login bool) []string {
if login {
return []string{"--login"}
}
return nil
}
var (
oldState *term.State
oldStateFd int
@@ -141,7 +148,7 @@ func runWrapper() {
adapter := shell.Current
ctx := context.Background()
c := exec.CommandContext(ctx, adapter.GetShellPath())
c := exec.CommandContext(ctx, adapter.GetShellPath(), shellArgs(config.Get().Core.ShellLogin)...)
c.ExtraFiles = make([]*os.File, 11)
// pass write end of pipe to shell as fd 13 (since index 10 maps to 13)
c.ExtraFiles[10] = w