Merge pull request #122 from easingthemes/bugfix/#120-inputs-string-bug

fix: #120 check undefined data
main
Dragan Filipović 2023-02-21 22:36:10 +01:00 committed by GitHub
commit b0ee052eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -16,11 +16,11 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom
try { try {
writeToFile({ dir: githubWorkspace, filename, content }); writeToFile({ dir: githubWorkspace, filename, content });
const dataLimit = 10000; const dataLimit = 10000;
const rsyncStdout = process.env.RSYNC_STDOUT.substring(0, dataLimit); const rsyncStdout = (process.env.RSYNC_STDOUT || '').substring(0, dataLimit);
console.log(`Executing remote script: ssh -i ${privateKeyPath} ${sshServer}`); console.log(`Executing remote script: ssh -i ${privateKeyPath} ${sshServer}`);
exec( exec(
`DEBIAN_FRONTEND=noninteractive ssh -p ${(remotePort || 22)} -i ${privateKeyPath} -o StrictHostKeyChecking=no ${sshServer} 'RSYNC_STDOUT="${rsyncStdout}" bash -s' < ${filename}`, `DEBIAN_FRONTEND=noninteractive ssh -p ${(remotePort || 22)} -i ${privateKeyPath} -o StrictHostKeyChecking=no ${sshServer} 'RSYNC_STDOUT="${rsyncStdout}" bash -s' < ${filename}`,
(err, data, stderr) => { (err, data = '', stderr = '') => {
if (err) { if (err) {
const message = `⚠️ [CMD] Remote script failed: ${err.message}`; const message = `⚠️ [CMD] Remote script failed: ${err.message}`;
console.warn(`${message} \n`, data, stderr); console.warn(`${message} \n`, data, stderr);