Skip to content

Commit

Permalink
fix: #120 check undefined data
Browse files Browse the repository at this point in the history
  • Loading branch information
easingthemes committed Feb 21, 2023
1 parent 51b2009 commit 2fbb060
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/remoteCmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom
try {
writeToFile({ dir: githubWorkspace, filename, content });
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}`);
exec(
`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) {
const message = `⚠️ [CMD] Remote script failed: ${err.message}`;
console.warn(`${message} \n`, data, stderr);
Expand Down

0 comments on commit 2fbb060

Please sign in to comment.