Skip to content

Commit 809ca03

Browse files
rewrite
1 parent 080fa8c commit 809ca03

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

dist/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58038,7 +58038,7 @@ async function GetProjectDetails(credential, xcodeVersion) {
5803858038
infoPlistPath = `${projectDirectory}/Info.plist`;
5803958039
}
5804058040
core.info(`Info.plist path: ${infoPlistPath}`);
58041-
const infoPlistHandle = await fs.promises.open(infoPlistPath, 'r');
58041+
const infoPlistHandle = await fs.promises.open(infoPlistPath, fs.constants.O_RDWR);
5804258042
let infoPlistContent;
5804358043
try {
5804458044
infoPlistContent = await fs.promises.readFile(infoPlistHandle, 'utf8');
@@ -58072,7 +58072,7 @@ async function GetProjectDetails(credential, xcodeVersion) {
5807258072
projectRef.bundleVersion = bundleVersion + 1;
5807358073
core.debug(`Auto Incremented bundle version ==> ${projectRef.bundleVersion}`);
5807458074
infoPlistJson['CFBundleVersion'] = projectRef.bundleVersion;
58075-
const plistHandle = await fs.promises.open(infoPlistPath, 'w');
58075+
const plistHandle = await fs.promises.open(infoPlistPath, fs.constants.O_RDWR);
5807658076
try {
5807758077
await fs.promises.writeFile(plistHandle, plist.build(infoPlistJson));
5807858078
core.info(`Updated Info.plist with CFBundleVersion: ${projectRef.bundleVersion}`);
@@ -58217,7 +58217,7 @@ async function ArchiveXcodeProject(projectRef) {
5821758217
}
5821858218
if (projectRef.entitlementsPath) {
5821958219
core.debug(`Entitlements path: ${projectRef.entitlementsPath}`);
58220-
const entitlementsHandle = await fs.promises.open(projectRef.entitlementsPath, 'r');
58220+
const entitlementsHandle = await fs.promises.open(projectRef.entitlementsPath, fs.constants.O_RDONLY);
5822158221
try {
5822258222
const entitlementsContent = await fs.promises.readFile(entitlementsHandle, 'utf8');
5822358223
core.debug(`----- Entitlements content: -----\n${entitlementsContent}\n-----------------------------------`);
@@ -58406,7 +58406,7 @@ async function getExportOptions(projectRef) {
5840658406
if (!exportOptionsPath) {
5840758407
throw new Error(`Invalid path for export-option-plist: ${exportOptionsPath}`);
5840858408
}
58409-
const exportOptionsHandle = await fs.promises.open(exportOptionsPath, 'r');
58409+
const exportOptionsHandle = await fs.promises.open(exportOptionsPath, fs.constants.O_RDONLY);
5841058410
try {
5841158411
const exportOptionContent = await fs.promises.readFile(exportOptionsHandle, 'utf8');
5841258412
core.info(`----- Export options content: -----\n${exportOptionContent}\n-----------------------------------`);
@@ -58532,8 +58532,8 @@ async function parseBundleLog(errorOutput) {
5853258532
(0, utilities_1.log)(`Log file path is a directory: ${logFilePath}`, 'warning');
5853358533
return;
5853458534
}
58535-
const logFileHandle = await fs.promises.open(logFilePath, 'r');
5853658535
let logFileContent;
58536+
const logFileHandle = await fs.promises.open(logFilePath, fs.constants.O_RDONLY);
5853758537
try {
5853858538
logFileContent = await fs.promises.readFile(logFileHandle, 'utf8');
5853958539
}

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/xcode.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export async function GetProjectDetails(credential: AppleCredential, xcodeVersio
6262
infoPlistPath = `${projectDirectory}/Info.plist`;
6363
}
6464
core.info(`Info.plist path: ${infoPlistPath}`);
65-
const infoPlistHandle = await fs.promises.open(infoPlistPath, 'r');
65+
const infoPlistHandle = await fs.promises.open(infoPlistPath, fs.constants.O_RDWR);
6666
let infoPlistContent: string;
6767
try {
6868
infoPlistContent = await fs.promises.readFile(infoPlistHandle, 'utf8');
@@ -104,7 +104,8 @@ export async function GetProjectDetails(credential: AppleCredential, xcodeVersio
104104
projectRef.bundleVersion = bundleVersion + 1;
105105
core.debug(`Auto Incremented bundle version ==> ${projectRef.bundleVersion}`);
106106
infoPlistJson['CFBundleVersion'] = projectRef.bundleVersion;
107-
const plistHandle = await fs.promises.open(infoPlistPath, 'w');
107+
// read and write handle
108+
const plistHandle = await fs.promises.open(infoPlistPath, fs.constants.O_RDWR);
108109
try {
109110
await fs.promises.writeFile(plistHandle, plist.build(infoPlistJson));
110111
core.info(`Updated Info.plist with CFBundleVersion: ${projectRef.bundleVersion}`);
@@ -254,7 +255,7 @@ export async function ArchiveXcodeProject(projectRef: XcodeProject): Promise<Xco
254255
}
255256
if (projectRef.entitlementsPath) {
256257
core.debug(`Entitlements path: ${projectRef.entitlementsPath}`);
257-
const entitlementsHandle = await fs.promises.open(projectRef.entitlementsPath, 'r');
258+
const entitlementsHandle = await fs.promises.open(projectRef.entitlementsPath, fs.constants.O_RDONLY);
258259
try {
259260
const entitlementsContent = await fs.promises.readFile(entitlementsHandle, 'utf8');
260261
core.debug(`----- Entitlements content: -----\n${entitlementsContent}\n-----------------------------------`);
@@ -441,7 +442,7 @@ async function getExportOptions(projectRef: XcodeProject): Promise<void> {
441442
if (!exportOptionsPath) {
442443
throw new Error(`Invalid path for export-option-plist: ${exportOptionsPath}`);
443444
}
444-
const exportOptionsHandle = await fs.promises.open(exportOptionsPath, 'r');
445+
const exportOptionsHandle = await fs.promises.open(exportOptionsPath, fs.constants.O_RDONLY);
445446
try {
446447
const exportOptionContent = await fs.promises.readFile(exportOptionsHandle, 'utf8');
447448
core.info(`----- Export options content: -----\n${exportOptionContent}\n-----------------------------------`);
@@ -568,8 +569,8 @@ async function parseBundleLog(errorOutput: string) {
568569
log(`Log file path is a directory: ${logFilePath}`, 'warning');
569570
return;
570571
}
571-
const logFileHandle = await fs.promises.open(logFilePath, 'r');
572572
let logFileContent: string;
573+
const logFileHandle = await fs.promises.open(logFilePath, fs.constants.O_RDONLY);
573574
try {
574575
logFileContent = await fs.promises.readFile(logFileHandle, 'utf8');
575576
} finally {

0 commit comments

Comments
 (0)