Skip to content

Commit f92d94b

Browse files
committed
fix: bugs seen with a test run
1 parent 6f4b5de commit f92d94b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/features/terminal/startup/bashStartup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ async function isZshInstalled(): Promise<boolean> {
2323
async function isGitBashInstalled(): Promise<boolean> {
2424
const gitPath = await which('git', { nothrow: true });
2525
if (gitPath) {
26-
const gitBashPath = path.join(path.dirname(gitPath), 'bin', 'bash.exe');
26+
const gitBashPath = path.join(path.dirname(path.dirname(gitPath)), 'bin', 'bash.exe');
2727
return await fs.pathExists(gitBashPath);
2828
}
2929
return false;
3030
}
3131

3232
async function getBashProfiles(): Promise<string[]> {
3333
const homeDir = os.homedir();
34-
const profiles: string[] = [path.join(homeDir, '.bashrc'), path.join(homeDir, '.bash_profile')];
34+
const profiles: string[] = [path.join(homeDir, '.bashrc')];
3535

3636
// Filter to only existing profiles or the first one if none exist
3737
const existingProfiles = await Promise.all(

src/features/terminal/startup/cmdStartup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const regionEnd = 'rem <<< vscode python';
6161

6262
function getActivationContent(key: string): string {
6363
const lineSep = isWindows() ? '\r\n' : '\n';
64-
return ['', '', regionStart, `if defined ${key} (`, ` call "%${key}%"`, ')', regionEnd, ''].join(lineSep);
64+
return ['', '', regionStart, `if defined ${key} (`, ` call %${key}%`, ')', regionEnd, ''].join(lineSep);
6565
}
6666

6767
function getMainBatchFileContent(startupFile: string, existingContent?: string): string {

src/features/terminal/startup/powershellStartup.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@ async function getPowerShellProfiles(): Promise<PowerShellInfo[]> {
2727
}
2828

2929
async function getProfileForShell(shell: 'powershell' | 'pwsh'): Promise<PowerShellInfo | undefined> {
30-
const profilePath = await runCommand(`${shell} -Command $profile`);
31-
if (!profilePath) {
32-
traceVerbose(`${shell} is not available or failed to get profile path`);
30+
try {
31+
const profilePath = await runCommand(`${shell} -Command $profile`);
32+
if (!profilePath) {
33+
traceVerbose(`${shell} is not available or failed to get profile path`);
34+
return undefined;
35+
}
36+
return { shell, profilePath };
37+
} catch (err) {
38+
traceVerbose(`${shell} is not available or failed to get profile path`, err);
3339
return undefined;
3440
}
35-
return { shell, profilePath };
3641
}
3742

3843
const regionStart = '#region vscode python';

0 commit comments

Comments
 (0)