mirror of
https://github.com/actions/setup-java
synced 2024-12-22 21:22:41 +00:00
logging options
This commit is contained in:
parent
bfbec53132
commit
12896dfb0f
2 changed files with 6 additions and 6 deletions
8
dist/index.js
generated
vendored
8
dist/index.js
generated
vendored
|
@ -4165,17 +4165,17 @@ function write(directory, settings) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const options = { encoding: 'utf-8', flag: 'wx' }; // 'wx': Like 'w' but fails if path exists
|
const options = { encoding: 'utf-8', flag: 'wx' }; // 'wx': Like 'w' but fails if path exists
|
||||||
const location = path.join(directory, exports.SETTINGS_FILE);
|
const location = path.join(directory, exports.SETTINGS_FILE);
|
||||||
console.log(`writing ${location}`);
|
console.log(`writing ${location} with options ${options}`);
|
||||||
try {
|
try {
|
||||||
return fs.writeFileSync(location, settings, options);
|
fs.writeFileSync(location, settings, options);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (!e.code)
|
|
||||||
throw e;
|
|
||||||
if (e.code == fs.constants.O_EXCL) {
|
if (e.code == fs.constants.O_EXCL) {
|
||||||
console.log(`overwriting existing file ${location}`);
|
console.log(`overwriting existing file ${location}`);
|
||||||
|
// default flag is 'w'
|
||||||
return fs.writeFileSync(location, settings, { encoding: 'utf-8' });
|
return fs.writeFileSync(location, settings, { encoding: 'utf-8' });
|
||||||
}
|
}
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ export function generate(id: string, username: string, password: string) {
|
||||||
async function write(directory: string, settings: string) {
|
async function write(directory: string, settings: string) {
|
||||||
const options = {encoding: 'utf-8', flag: 'wx'}; // 'wx': Like 'w' but fails if path exists
|
const options = {encoding: 'utf-8', flag: 'wx'}; // 'wx': Like 'w' but fails if path exists
|
||||||
const location = path.join(directory, SETTINGS_FILE);
|
const location = path.join(directory, SETTINGS_FILE);
|
||||||
console.log(`writing ${location}`);
|
console.log(`writing ${location} with options ${options}`);
|
||||||
try {
|
try {
|
||||||
return fs.writeFileSync(location, settings, options);
|
fs.writeFileSync(location, settings, options);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code == fs.constants.O_EXCL) {
|
if (e.code == fs.constants.O_EXCL) {
|
||||||
console.log(`overwriting existing file ${location}`);
|
console.log(`overwriting existing file ${location}`);
|
||||||
|
|
Loading…
Reference in a new issue