terminal: fix posix_spawnp failure (spawn-helper exec bit), half-viewport default, fullscreen toggle, middle-click close
- Root cause of the endless 'disconnected, reconnecting' banner: pnpm strips the executable bit from node-pty's prebuilt spawn-helper, so every spawn failed with posix_spawnp failed and the client retried forever. ensureSpawnHelper() restores 0755 at plugin activation (mirrors dsh-pty-local's postinstall; works for link installs too). Verified against the live GUI: terminal now connects and echoes. - TerminalView stops auto-reconnecting on a server refusal (close 1011 with a reason): shows the reason plus a manual retry instead of spinning. - defaultShell() also guards an empty SHELL. - New sessions open at half the viewport width; width clamping now allows filling the window, and a header fullscreen button expands the sidebar to the full viewport (toggle restores half). - Middle-click on a tab closes it (auxclick button 1, autoscroll suppressed). - Tests: +2 (shell fallback, spawn-helper exec bit idempotent).
This commit is contained in:
1 parent
58b4bd71ba
commit
c7a7c7e5af
10 files changed
+160
-14
No files matched your search
+4
-1
@@ -19,7 +19,7 @@ import type { Context } from './context-types.ts'
|
||||
import { parentOf, requireAbsolute, listDirectory, rootLabel } from './fs-tree.ts'
|
||||
import { isTrustedApiRequest } from './trust-fence.ts'
|
||||
import * as git from './git.ts'
|
||||
import { defaultShell, PtyManager } from './pty-manager.ts'
|
||||
import { defaultShell, ensureSpawnHelper, PtyManager } from './pty-manager.ts'
|
||||
import { readJsonBody, requireString, SidebarError, writeError, writeJson, writeOk } from './wire.ts'
|
||||
|
||||
/** Plugin identity for cordis.yml rows. */
|
||||
@@ -194,6 +194,9 @@ function buildApi(ctx: Context, ptyManager: PtyManager): Record<string, ApiMetho
|
||||
* @param ctx - host plugin context (httpServer, sessions, loader).
|
||||
*/
|
||||
export function apply(ctx: Context): void {
|
||||
// pnpm strips the executable bit from node-pty's prebuilt spawn-helper;
|
||||
// restore it before any terminal can spawn (idempotent).
|
||||
ensureSpawnHelper()
|
||||
const trustedHosts = trustedHostsOf(ctx)
|
||||
const fence = (req: IncomingMessage): boolean => isTrustedApiRequest(req, trustedHosts)
|
||||
const ptyManager = new PtyManager(defaultShell(), TERMINALS_PER_SESSION)
|
||||
|
||||
Reference in new issue
Block a user