fix: resolve the account login shell and spawn terminals as login shells

Terminal tabs resolved the shell from the dsh process environment only,
falling back to a hardcoded /bin/bash — service-managed launches without
SHELL therefore ignored the account's login shell (e.g. zsh). They also
spawned with an empty argv, so even a resolved zsh ran as a non-login
shell and skipped ~/.zprofile.

defaultShell() now falls back to the account's login shell (passwd) after
$SHELL, and both registries spawn POSIX shells with -l so the tab behaves
like a terminal emulator (loads ~/.profile / ~/.zprofile). Windows keeps
powershell.exe with no login flag.

Fixes omdsh-dev/DSH-better-sidebar#68
This commit is contained in:
NolanHo
2026-08-14 10:15:34 -07:00
parent 4e275aa321
commit 76fa7df264
4 changed files with 87 additions and 11 deletions
+2 -2
View File
@@ -13,7 +13,7 @@
*/
import { randomUUID } from 'node:crypto'
import * as nodePty from 'node-pty'
import { ensureSpawnHelper } from './pty-manager.ts'
import { ensureSpawnHelper, shellSpawnArgs } from './pty-manager.ts'
import { SidebarError } from './wire.ts'
/** Per-agent-terminal transcript bound (bytes kept for replay and reads). */
@@ -211,7 +211,7 @@ export class AgentPtyRegistry {
): string {
const uuid = randomUUID()
const dims = clampDims(cols, rows)
const pty = nodePty.spawn(this.shell, [], {
const pty = nodePty.spawn(this.shell, shellSpawnArgs(), {
name: 'xterm-256color',
cols: dims.cols,
rows: dims.rows,