Update exec command, remove mock from unit tests
This commit is contained in:
parent
6e46140c9c
commit
96d176662d
3 changed files with 4 additions and 23 deletions
|
@ -114,12 +114,6 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||
dependencyFile
|
||||
);
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
getLinuxOSReleaseInfoSpy.mockImplementation(() =>
|
||||
Promise.resolve('Ubuntu-20.4')
|
||||
);
|
||||
}
|
||||
|
||||
await cacheDistributor.restoreCache();
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
|
|
11
dist/setup/index.js
vendored
11
dist/setup/index.js
vendored
|
@ -65484,17 +65484,10 @@ function isCacheFeatureAvailable() {
|
|||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||
function getLinuxOSReleaseInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { stdout, stderr, exitCode } = yield exec.getExecOutput('lsb_release', ['-a'], {
|
||||
const { stdout, stderr, exitCode } = yield exec.getExecOutput('lsb_release', ['-i -r -s'], {
|
||||
silent: true
|
||||
});
|
||||
let osVersion = '';
|
||||
let osRelease = '';
|
||||
stdout.split('\n').forEach(elem => {
|
||||
if (elem.includes('Distributor'))
|
||||
osVersion = elem.split(':')[1].trim();
|
||||
if (elem.includes('Release'))
|
||||
osRelease = elem.split(':')[1].trim();
|
||||
});
|
||||
const [osRelease, osVersion] = stdout.trim().split('\n');
|
||||
core.debug(`OS Release: ${osRelease}, Version: ${osVersion}`);
|
||||
return `${osVersion}-${osRelease}`;
|
||||
});
|
||||
|
|
10
src/utils.ts
10
src/utils.ts
|
@ -124,19 +124,13 @@ export function isCacheFeatureAvailable(): boolean {
|
|||
export async function getLinuxOSReleaseInfo() {
|
||||
const {stdout, stderr, exitCode} = await exec.getExecOutput(
|
||||
'lsb_release',
|
||||
['-a'],
|
||||
['-i -r -s'],
|
||||
{
|
||||
silent: true
|
||||
}
|
||||
);
|
||||
|
||||
let osVersion = '';
|
||||
let osRelease = '';
|
||||
|
||||
stdout.split('\n').forEach(elem => {
|
||||
if (elem.includes('Distributor')) osVersion = elem.split(':')[1].trim();
|
||||
if (elem.includes('Release')) osRelease = elem.split(':')[1].trim();
|
||||
});
|
||||
const [osRelease, osVersion] = stdout.trim().split('\n');
|
||||
|
||||
core.debug(`OS Release: ${osRelease}, Version: ${osVersion}`);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue