Skip to content

Commit 606d5c7

Browse files
committed
fix: always prefer podman cli from installer path
fixes podman-desktop#8982 Signed-off-by: Florent Benoit <[email protected]>
1 parent 96cf9d7 commit 606d5c7

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

extensions/kind/src/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { isAbsolute, join } from 'node:path';
2222

2323
import * as extensionApi from '@podman-desktop/api';
2424

25-
const macosExtraPath = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin:/opt/podman/bin';
25+
const macosExtraPath = '/opt/podman/bin:/usr/local/bin:/opt/homebrew/bin:/opt/local/bin';
2626
const localBinDir = '/usr/local/bin';
2727

2828
export function getSystemBinaryPath(binaryName: string): string {

extensions/podman/packages/extension/src/compatibility-mode.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ export class DarwinSocketCompatibility extends SocketCompatibility {
5252
// Find the podman-mac-helper binary which should only be located in either
5353
// brew or podman's install location
5454
findPodmanHelper(): string {
55-
const homebrewPath = '/opt/homebrew/bin/podman-mac-helper';
5655
const podmanPath = '/opt/podman/bin/podman-mac-helper';
56+
const homebrewPath = '/opt/homebrew/bin/podman-mac-helper';
5757
const userBinaryPath = '/usr/local/bin/podman-mac-helper';
5858

59-
if (fs.existsSync(homebrewPath)) {
60-
return homebrewPath;
61-
} else if (fs.existsSync(podmanPath)) {
59+
if (fs.existsSync(podmanPath)) {
6260
return podmanPath;
61+
} else if (fs.existsSync(homebrewPath)) {
62+
return homebrewPath;
6363
} else if (fs.existsSync(userBinaryPath)) {
6464
return userBinaryPath;
6565
} else {

extensions/podman/packages/extension/src/podman-cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import * as extensionApi from '@podman-desktop/api';
1919

2020
import { isMac, isWindows } from './util';
2121

22-
const macosExtraPath = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin:/opt/podman/bin';
22+
const macosExtraPath = '/opt/podman/bin:/usr/local/bin:/opt/homebrew/bin:/opt/local/bin';
2323

2424
export function getInstallationPath(): string | undefined {
2525
const env = process.env;

packages/main/src/plugin/docker-extension/docker-plugin-adapter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface RawExecResult {
3737
}
3838

3939
export class DockerPluginAdapter {
40-
static readonly MACOS_EXTRA_PATH = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin:/opt/podman/bin';
40+
static readonly MACOS_EXTRA_PATH = '/opt/podman/bin:/usr/local/bin:/opt/homebrew/bin:/opt/local/bin';
4141

4242
constructor(
4343
private contributionManager: ContributionManager,

packages/main/src/plugin/util/exec.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ describe('getInstallationPath', () => {
608608

609609
const path = getInstallationPath();
610610

611-
expect(path).toBe(`/usr/bin:${macosExtraPath}`);
611+
expect(path).toBe(`${macosExtraPath}:/usr/bin`);
612612
});
613613

614614
test('should return the installation path for macOS with defined param', () => {
@@ -619,7 +619,7 @@ describe('getInstallationPath', () => {
619619

620620
const path = getInstallationPath('/usr/other');
621621

622-
expect(path).toBe(`/usr/other:${macosExtraPath}`);
622+
expect(path).toBe(`${macosExtraPath}:/usr/other`);
623623
});
624624

625625
test('should return the installation path for other platforms', () => {

packages/main/src/plugin/util/exec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import * as sudo from 'sudo-prompt';
2525
import { isLinux, isMac, isWindows } from '../../util.js';
2626
import type { Proxy } from '../proxy.js';
2727

28-
export const macosExtraPath = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin:/opt/podman/bin';
28+
export const macosExtraPath = '/opt/podman/bin:/usr/local/bin:/opt/homebrew/bin:/opt/local/bin';
2929

3030
class RunErrorImpl extends Error implements RunError {
3131
constructor(
@@ -248,7 +248,7 @@ export function getInstallationPath(envPATH?: string): string {
248248
if (!envPATH) {
249249
return macosExtraPath;
250250
} else {
251-
return envPATH.concat(':').concat(macosExtraPath);
251+
return macosExtraPath.concat(':').concat(envPATH);
252252
}
253253
} else {
254254
return envPATH ?? '';

0 commit comments

Comments
 (0)