Skip to content

Commit b598492

Browse files
committed
fix: addressing comments
1 parent 4dfa582 commit b598492

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

packages/core/src/shared/vscode/env.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,15 @@ export function isAmazonLinux2() {
170170
const fs = require('fs')
171171
if (fs.existsSync('/etc/os-release')) {
172172
const osRelease = fs.readFileSync('/etc/os-release', 'utf8')
173+
174+
// Check if this is Amazon Linux 2023 (not AL2)
175+
if (osRelease.includes('VERSION_ID="2023"') || osRelease.includes('PLATFORM_ID="platform:al2023"')) {
176+
// This is Amazon Linux 2023, not AL2
177+
return false
178+
}
179+
173180
// Check if this is actually Amazon Linux 2
181+
// Must be specifically version 2, not 2023 or other versions
174182
const isAL2 =
175183
osRelease.includes('Amazon Linux 2') ||
176184
(osRelease.includes('ID="amzn"') && osRelease.includes('VERSION_ID="2"'))

packages/core/src/test/shared/vscode/env.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import path from 'path'
88
import { isCloudDesktop, getEnvVars, getServiceEnvVarConfig, isAmazonLinux2, isBeta } from '../../../shared/vscode/env'
99
import { ChildProcess } from '../../../shared/utilities/processUtils'
1010
import * as sinon from 'sinon'
11-
import * as nodeFs from 'fs' // eslint-disable-line no-restricted-imports
1211
import os from 'os'
1312
import fs from '../../../shared/fs/fs'
1413
import vscode from 'vscode'
@@ -110,20 +109,6 @@ describe('env', function () {
110109

111110
versionStub.returns('5.10.220-188.869.NOT_INTERNAL.x86_64')
112111
assert.strictEqual(isAmazonLinux2(), false)
113-
114-
// Test with container environment (Ubuntu container on AL2 host)
115-
versionStub.returns('5.10.236-227.928.amzn2.x86_64')
116-
const existsStub = sandbox.stub(nodeFs, 'existsSync').returns(true)
117-
const readFileStub = sandbox.stub(nodeFs, 'readFileSync').returns('ID="ubuntu"\nVERSION_ID="20.04"')
118-
assert.strictEqual(isAmazonLinux2(), false, 'Should return false for Ubuntu container on AL2 host')
119-
120-
// Test with actual AL2 in /etc/os-release
121-
readFileStub.returns('ID="amzn"\nVERSION_ID="2"')
122-
assert.strictEqual(isAmazonLinux2(), true, 'Should return true for actual AL2')
123-
124-
// Clean up stubs
125-
existsStub.restore()
126-
readFileStub.restore()
127112
})
128113

129114
it('isCloudDesktop', async function () {

0 commit comments

Comments
 (0)