Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion __tests__/setup-java.module-loading.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jest.unstable_mockModule('@actions/core', () => ({

jest.unstable_mockModule('fs', () => ({
default: {
readFileSync: jest.fn()
readFileSync: jest.fn(),
realpathSync: jest.fn()
}
}));

Expand Down
3 changes: 2 additions & 1 deletion __tests__/setup-java.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jest.unstable_mockModule('@actions/core', () => ({

jest.unstable_mockModule('fs', () => ({
default: {
readFileSync: jest.fn()
readFileSync: jest.fn(),
realpathSync: jest.fn()
}
}));

Expand Down
4 changes: 3 additions & 1 deletion dist/cleanup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35747,6 +35747,7 @@ __nccwpck_require__.d(__webpack_exports__, {
var cleanup_java_core = __nccwpck_require__(3838);
// EXTERNAL MODULE: external "fs"
var external_fs_ = __nccwpck_require__(9896);
var external_fs_default = /*#__PURE__*/__nccwpck_require__.n(external_fs_);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(6928);
// EXTERNAL MODULE: external "crypto"
Expand Down Expand Up @@ -35896,6 +35897,7 @@ var external_url_ = __nccwpck_require__(7016);




async function cleanup_java_removeGpgHome() {
const gpgHome = cleanup_java_core/* getState */.Gu(constants/* STATE_GPG_HOME */.Fi);
if (!gpgHome) {
Expand Down Expand Up @@ -35957,7 +35959,7 @@ async function run() {
await cleanup_java_removeGpgHome();
await ignoreError(saveCaches());
}
if (process.argv[1] === (0,external_url_.fileURLToPath)(import.meta.url)) {
if (external_fs_default().realpathSync(process.argv[1]) === (0,external_url_.fileURLToPath)(import.meta.url)) {
run();
}
else {
Expand Down
2 changes: 1 addition & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36480,7 +36480,7 @@ async function validateCacheInput(cache) {
function settle(promise) {
return promise.then(value => ({ status: 'fulfilled', value }), reason => ({ status: 'rejected', reason }));
}
if (process.argv[1] === (0,external_url_.fileURLToPath)(import.meta.url)) {
if (external_fs_default().realpathSync(process.argv[1]) === (0,external_url_.fileURLToPath)(import.meta.url)) {
run();
}
else {
Expand Down
3 changes: 2 additions & 1 deletion src/cleanup-java.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as core from '@actions/core';
import * as gpg from './gpg.js';
import * as constants from './constants.js';
import fs from 'fs';
import {
getBooleanInput,
isJdkCacheEnabled,
Expand Down Expand Up @@ -77,7 +78,7 @@ export async function run() {
await ignoreError(saveCaches());
}

if (process.argv[1] === fileURLToPath(import.meta.url)) {
if (fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
run();
} else {
// https://nodejs.org/api/modules.html#modules_accessing_the_main_module
Expand Down
2 changes: 1 addition & 1 deletion src/setup-java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function settle<T>(promise: Promise<T>): Promise<PromiseSettledResult<T>> {
);
}

if (process.argv[1] === fileURLToPath(import.meta.url)) {
if (fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
run();
} else {
// https://nodejs.org/api/modules.html#modules_accessing_the_main_module
Expand Down