mirror of
https://github.com/easingthemes/ssh-deploy
synced 2025-04-21 15:52:12 +00:00
fix path arg
This commit is contained in:
parent
5dfe8ebb5a
commit
11a1bc7795
@ -2,6 +2,10 @@ const { existsSync, mkdirSync, writeFileSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
|
||||
const validateDir = (dir) => {
|
||||
if (!dir) {
|
||||
console.log('[SSH] dir is not defined');
|
||||
return;
|
||||
}
|
||||
if (existsSync(dir)) {
|
||||
console.log(`[SSH] ${dir} dir exist`);
|
||||
return;
|
||||
|
@ -1,15 +1,14 @@
|
||||
const { join } = require('path');
|
||||
const { exec } = require('child_process');
|
||||
|
||||
const { sshServer, githubWorkspace } = require('./inputs');
|
||||
const { writeToFile } = require('./helpers');
|
||||
|
||||
const remoteCmd = (cmd, label) => {
|
||||
const localScriptPath = join(githubWorkspace, `local_ssh_script-${label}.sh`);
|
||||
const remoteCmd = (content, label) => {
|
||||
const filename = `local_ssh_script-${label}.sh`;
|
||||
try {
|
||||
writeToFile(localScriptPath, cmd);
|
||||
writeToFile({ dir: githubWorkspace, filename, content });
|
||||
|
||||
exec(`ssh ${sshServer} 'bash -s' < ${localScriptPath}`, (err, data, stderr) => {
|
||||
exec(`ssh ${sshServer} 'bash -s' < ${filename}`, (err, data, stderr) => {
|
||||
if (err) {
|
||||
console.log('⚠️ [CMD] Remote script failed. ', err.message);
|
||||
} else {
|
||||
|
@ -10,7 +10,7 @@ const addSshKey = (content, filename) => {
|
||||
writeToFile({ dir, filename: 'known_hosts', content: '' });
|
||||
writeToFile({ dir, filename, content, isRequired: true });
|
||||
|
||||
console.log('✅ Ssh key added to `.ssh` dir ', dir);
|
||||
console.log('✅ [SSH] key added to `.ssh` dir ', dir);
|
||||
|
||||
return filePath;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user