Append to script instead read then write

This commit is contained in:
Shivam Mathur 2022-01-29 04:45:17 +05:30
parent 63c7766312
commit c2c73b16c1
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 4 additions and 4 deletions

4
dist/index.js vendored
View File

@ -455,7 +455,7 @@ async function getScript(filename, version, os_version) {
const coverage_driver = await utils.getInput('coverage', false);
const tools_csv = await utils.getInput('tools', false);
const script_path = path_1.default.join(__dirname, '../src/scripts', filename);
let script = fs_1.default.readFileSync(script_path, 'utf8');
let script = '\n';
if (extension_csv) {
script += await extensions.addExtension(extension_csv, version, os_version);
}
@ -468,7 +468,7 @@ async function getScript(filename, version, os_version) {
}
script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os_version));
script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os_version));
fs_1.default.writeFileSync(script_path, script, { mode: 0o755 });
fs_1.default.appendFileSync(script_path, script, { mode: 0o755 });
return script_path;
}
exports.getScript = getScript;

View File

@ -28,7 +28,7 @@ export async function getScript(
const coverage_driver: string = await utils.getInput('coverage', false);
const tools_csv: string = await utils.getInput('tools', false);
const script_path = path.join(__dirname, '../src/scripts', filename);
let script: string = fs.readFileSync(script_path, 'utf8');
let script = '\n';
if (extension_csv) {
script += await extensions.addExtension(extension_csv, version, os_version);
}
@ -42,7 +42,7 @@ export async function getScript(
script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os_version));
script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os_version));
fs.writeFileSync(script_path, script, {mode: 0o755});
fs.appendFileSync(script_path, script, {mode: 0o755});
return script_path;
}