Skip to content

Commit

Permalink
fix: add to path manually on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Dec 22, 2024
1 parent 970b97a commit a86b2fa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/pty-manager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { IpcListener } from '@electron-toolkit/typed-ipc/main';
import { ipcMain } from 'electron';
import path from 'path';

import { PtyManager } from '@/lib/pty';
import { getActivateVenvCommand, getHomeDirectory, getInstallationDetails } from '@/main/util';
import { getActivateVenvCommand, getHomeDirectory, getInstallationDetails, getUVExecutablePath } from '@/main/util';
import type { IpcEvents, IpcRendererEvents, PtyOptions } from '@/shared/types';

export const createPtyManager = (arg: {
Expand Down Expand Up @@ -31,6 +32,15 @@ export const createPtyManager = (arg: {

const entry = ptyManager.create({ onData, onExit, options });

// Add the UV executable path to the PATH environment variable
const newPath = `${getUVExecutablePath()}${path.delimiter}${process.env.PATH}`;

if (process.platform === 'win32') {
entry.process.write(`$env:PATH="${newPath}"\r`);
} else {
// macOS, Linux
entry.process.write(`export PATH=${newPath}\r`);
}

if (cwd) {
const installDetails = await getInstallationDetails(cwd);
Expand Down

0 comments on commit a86b2fa

Please sign in to comment.