Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use zsh when running uv in VirtualEnv for macOS. #460

Merged
merged 1 commit into from
Dec 10, 2024
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
2 changes: 1 addition & 1 deletion src/main-process/comfyDesktopApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getModelsDirectory, validateHardware } from '../utils';
import { DownloadManager } from '../models/DownloadManager';
import { VirtualEnvironment } from '../virtualEnvironment';
import { InstallWizard } from '../install/installWizard';
import { Terminal } from '../terminal';
import { Terminal } from '../shell/terminal';
import { DesktopConfig } from '../store/desktopConfig';
import { InstallationValidator } from '../install/installationValidator';
import { restoreCustomNodes } from '../services/backup';
Expand Down
19 changes: 4 additions & 15 deletions src/terminal.ts → src/shell/terminal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as os from 'node:os';
import * as pty from 'node-pty';
import { AppWindow } from './main-process/appWindow';
import { IPC_CHANNELS } from './constants';
import { AppWindow } from '../main-process/appWindow';
import { IPC_CHANNELS } from '../constants';
import { getDefaultShell } from './util';

export class Terminal {
#pty: pty.IPty | undefined;
Expand Down Expand Up @@ -48,7 +48,7 @@ export class Terminal {
#createPty() {
const window = this.window;
// TODO: does this want to be a setting?
const shell = this.#getDefaultShell();
const shell = getDefaultShell();
const instance = pty.spawn(shell, [], {
handleFlowControl: false,
conptyInheritCursor: false,
Expand All @@ -74,15 +74,4 @@ export class Terminal {

return instance;
}

#getDefaultShell(): string {
switch (os.platform()) {
case 'win32':
return 'powershell.exe';
case 'darwin':
return 'zsh';
default: // Linux and others
return 'bash';
}
}
}
12 changes: 12 additions & 0 deletions src/shell/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os from 'os';

export function getDefaultShell(): string {
switch (os.platform()) {
case 'win32':
return 'powershell.exe';
case 'darwin':
return 'zsh';
default: // Linux and others
return 'bash';
}
}
3 changes: 2 additions & 1 deletion src/virtualEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { pathAccessible } from './utils';
import { app } from 'electron';
import * as pty from 'node-pty';
import * as os from 'os';
import { getDefaultShell } from './shell/util';

type ProcessCallbacks = {
onStdout?: (data: string) => void;
Expand All @@ -28,7 +29,7 @@ export class VirtualEnvironment {

get uvPtyInstance() {
if (!this.uvPty) {
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
const shell = getDefaultShell();
this.uvPty = pty.spawn(shell, [], {
handleFlowControl: false,
conptyInheritCursor: false,
Expand Down
Loading