Skip to content
Merged
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
3 changes: 1 addition & 2 deletions src/main/services/ptyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1349,10 +1349,9 @@ export async function startPty(options: {
}

// Lazy load native module at call time to prevent startup crashes
// eslint-disable-next-line @typescript-eslint/no-var-requires
let pty: typeof import('node-pty');
try {
pty = require('node-pty');
pty = await import('node-pty');
} catch (e: any) {
throw new Error(`PTY unavailable: ${e?.message || String(e)}`);
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/main/ptyManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ describe('ptyManager provider command resolution', () => {
});

it('spawns tmux using its absolute path when tmux wrapping is enabled', async () => {
const origPath = process.env.PATH;
process.env.PATH = `/opt/homebrew/bin${origPath ? ':' + origPath : ''}`;

fsStatSyncMock.mockImplementation((candidate: string) => {
if (candidate === '/opt/homebrew/bin/tmux') {
return { isFile: () => true };
Expand All @@ -353,6 +356,8 @@ describe('ptyManager provider command resolution', () => {
tmux: true,
});

process.env.PATH = origPath;

expect(nodePtySpawnMock).toHaveBeenCalledWith(
'/opt/homebrew/bin/tmux',
['new-session', '-As', getTmuxSessionName('claude-main-task-tmux'), '--', '/bin/zsh', '-il'],
Expand Down
Loading