Skip to content

Commit ea3f3da

Browse files
committed
chore: use env for windows and linux
Just updates windows and linux to use PD env API instead of os.platform(), so that it is consistent with mac. Tests mock to mac for now, as they're not doing anything dependent on execution OS. Fixes #1207. Signed-off-by: Tim deBoer <[email protected]>
1 parent 038ab6c commit ea3f3da

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/backend/src/machine-utils.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**********************************************************************
2-
* Copyright (C) 2024 Red Hat, Inc.
2+
* Copyright (C) 2024-2025 Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,6 +51,11 @@ vi.mock('@podman-desktop/api', async () => {
5151
};
5252
},
5353
},
54+
env: {
55+
isMac: true,
56+
isLinux: false,
57+
isWindows: false,
58+
},
5459
process: {
5560
exec: vi.fn(),
5661
},

packages/backend/src/machine-utils.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**********************************************************************
2-
* Copyright (C) 2024 Red Hat, Inc.
2+
* Copyright (C) 2024-2025 Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -165,14 +165,12 @@ function getCustomBinaryPath(): string | undefined {
165165
return extensionApi.configuration.getConfiguration('podman').get('binary.path');
166166
}
167167

168-
const windows = os.platform() === 'win32';
169168
export function isWindows(): boolean {
170-
return windows;
169+
return env.isWindows;
171170
}
172171

173-
const linux = os.platform() === 'linux';
174172
export function isLinux(): boolean {
175-
return linux;
173+
return env.isLinux;
176174
}
177175

178176
export function isMac(): boolean {

0 commit comments

Comments
 (0)