feat: enhance environment path handling with buildAugmentedPath function
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import type { OpenCodeManager } from './opencode';
|
||||
import { buildAugmentedPath, type OpenCodeManager } from './opencode';
|
||||
import { createAgent, createCommand, deleteAgent, deleteCommand, getAgentSources, getCommandSources, updateAgent, updateCommand, type AgentScope, type CommandScope, AGENT_SCOPE, COMMAND_SCOPE, discoverSkills, getSkillSources, createSkill, updateSkill, deleteSkill, readSkillSupportingFile, writeSkillSupportingFile, deleteSkillSupportingFile, type SkillScope, SKILL_SCOPE } from './opencodeConfig';
|
||||
import { removeProviderAuth } from './opencodeAuth';
|
||||
import * as gitService from './gitService';
|
||||
@@ -602,6 +602,11 @@ export async function handleBridgeMessage(message: BridgeRequest, ctx?: BridgeCo
|
||||
const shell = process.env.SHELL || (process.platform === 'win32' ? 'cmd.exe' : '/bin/sh');
|
||||
const shellFlag = process.platform === 'win32' ? '/c' : '-c';
|
||||
|
||||
const augmentedEnv = {
|
||||
...process.env,
|
||||
PATH: buildAugmentedPath(),
|
||||
};
|
||||
|
||||
const results: Array<{
|
||||
command: string;
|
||||
success: boolean;
|
||||
@@ -620,6 +625,7 @@ export async function handleBridgeMessage(message: BridgeRequest, ctx?: BridgeCo
|
||||
// Use async exec to not block the extension host event loop
|
||||
const { stdout, stderr } = await execAsync(`${shell} ${shellFlag} "${cmd.replace(/"/g, '\\"')}"`, {
|
||||
cwd: resolvedCwd,
|
||||
env: augmentedEnv,
|
||||
timeout: 300000, // 5 minutes per command
|
||||
});
|
||||
results.push({
|
||||
|
||||
@@ -126,7 +126,7 @@ function getLoginShellPath(): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
function buildAugmentedPath(): string {
|
||||
export function buildAugmentedPath(): string {
|
||||
const augmented = new Set<string>();
|
||||
|
||||
const loginPath = getLoginShellPath();
|
||||
|
||||
Reference in New Issue
Block a user