Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class ContainerManager {
private audit: AuditLog | null = null;
private policy: PolicyEngine | null = null;
private activeProcessCount = 0;
private onDataDisposable: { dispose(): void } | null = null;
private outputLineBuf = '';
private outputFlushTimer: ReturnType<typeof setTimeout> | null = null;
private gitService: GitService | null = null;
Expand Down Expand Up @@ -369,7 +370,8 @@ export class ContainerManager {

// Wire keystrokes directly to gitclaw stdin (no jsh in between)
this.shellWriter = this.shellProcess.input.getWriter();
terminal.onData((data) => {
this.onDataDisposable?.dispose();
this.onDataDisposable = terminal.onData((data) => {
this.shellWriter?.write(data);
this.audit?.logStdin(data);
});
Expand Down Expand Up @@ -418,7 +420,8 @@ export class ContainerManager {
);

this.shellWriter = this.shellProcess.input.getWriter();
terminal.onData((data) => {
this.onDataDisposable?.dispose();
this.onDataDisposable = terminal.onData((data) => {
this.shellWriter?.write(data);
this.audit?.logStdin(data);
});
Expand Down Expand Up @@ -593,7 +596,8 @@ export class ContainerManager {
);

this.shellWriter = this.shellProcess.input.getWriter();
terminal.onData((data) => {
this.onDataDisposable?.dispose();
this.onDataDisposable = terminal.onData((data) => {
this.shellWriter?.write(data);
this.audit?.logStdin(data);
});
Expand Down
4 changes: 2 additions & 2 deletions src/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export class TerminalManager {
}

/** Register a handler for user keystrokes (sent to shell stdin). */
onData(handler: (data: string) => void): void {
this.xterm.onData(handler);
onData(handler: (data: string) => void): { dispose(): void } {
return this.xterm.onData(handler);
}

/** Current terminal dimensions for pty resize. */
Expand Down