feat: apply deleteFile function to remoteCmd

This commit is contained in:
Emmanuel Isenah 2024-03-17 22:19:44 +01:00
parent 1befdb1c6b
commit b82eced457

View File

@ -1,7 +1,7 @@
const { exec } = require('child_process');
const crypto = require('crypto');
const { sshServer, githubWorkspace, remotePort } = require('./inputs');
const { writeToFile } = require('./helpers');
const { writeToFile, deleteFile } = require('./helpers');
const handleError = (message, isRequired, callback) => {
if (isRequired) {
@ -30,6 +30,8 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom
} else {
const limited = data.substring(0, dataLimit);
console.log('✅ [CMD] Remote script executed. \n', limited, stderr);
deleteFile({ dir: githubWorkspace, filename });
console.log('✅ [FILE] Script file deleted.');
resolve(limited);
}
}