mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-31 23:40:10 +08:00 
			
		
		
		
	fix promise
This commit is contained in:
		
							parent
							
								
									11a1bc7795
								
							
						
					
					
						commit
						a16ae38e86
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -2,13 +2,14 @@ const { execSync } = require('child_process'); | |||||||
| const which = require('which'); | const which = require('which'); | ||||||
| const nodeRsync = require('rsyncwrapper'); | const nodeRsync = require('rsyncwrapper'); | ||||||
| 
 | 
 | ||||||
| const validateRsync = async () => { | // eslint-disable-next-line no-async-promise-executor
 | ||||||
|  | const validateRsync = () => new Promise(async (resolve, reject) => { | ||||||
|   const rsyncCli = await which('rsync', { nothrow: true }); |   const rsyncCli = await which('rsync', { nothrow: true }); | ||||||
|   execSync('rsync --version', { stdio: 'inherit' }); |   execSync('rsync --version', { stdio: 'inherit' }); | ||||||
|   if (rsyncCli) { |   if (rsyncCli) { | ||||||
|     console.log('⚠️ [CLI] Rsync exists'); |     console.log('⚠️ [CLI] Rsync exists'); | ||||||
|     execSync('rsync --version', { stdio: 'inherit' }); |     execSync('rsync --version', { stdio: 'inherit' }); | ||||||
|     return; |     resolve(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   console.log('⚠️ [CLI] Rsync doesn\'t exists. Start installation with "apt-get" \n'); |   console.log('⚠️ [CLI] Rsync doesn\'t exists. Start installation with "apt-get" \n'); | ||||||
| @ -16,10 +17,11 @@ const validateRsync = async () => { | |||||||
|   try { |   try { | ||||||
|     execSync('sudo apt-get update && sudo apt-get --no-install-recommends install rsync', { stdio: 'inherit' }); |     execSync('sudo apt-get update && sudo apt-get --no-install-recommends install rsync', { stdio: 'inherit' }); | ||||||
|     console.log('✅ [CLI] Rsync installed. \n'); |     console.log('✅ [CLI] Rsync installed. \n'); | ||||||
|  |     resolve(); | ||||||
|   } catch (err) { |   } catch (err) { | ||||||
|     throw new Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${err.message}`); |     reject(Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${err.message}`)); | ||||||
|   } |   } | ||||||
| }; | }); | ||||||
| 
 | 
 | ||||||
| const rsyncCli = ({ | const rsyncCli = ({ | ||||||
|   source, sshServer, exclude, remotePort, |   source, sshServer, exclude, remotePort, | ||||||
| @ -39,7 +41,7 @@ const rsyncCli = ({ | |||||||
|     /* eslint-disable object-property-newline */ |     /* eslint-disable object-property-newline */ | ||||||
|     nodeRsync({ |     nodeRsync({ | ||||||
|       src: source, dest: sshServer, excludeFirst: exclude, port: remotePort, |       src: source, dest: sshServer, excludeFirst: exclude, port: remotePort, | ||||||
|       privateKey, args, callback, |       privateKey, args, | ||||||
|       ...defaultOptions |       ...defaultOptions | ||||||
|     }, (error, stdout, stderr, cmd) => { |     }, (error, stdout, stderr, cmd) => { | ||||||
|       if (error) { |       if (error) { | ||||||
|  | |||||||
| @ -8,8 +8,8 @@ const addSshKey = (content, filename) => { | |||||||
|   const filePath = join(dir, filename); |   const filePath = join(dir, filename); | ||||||
| 
 | 
 | ||||||
|   writeToFile({ dir, filename: 'known_hosts', content: '' }); |   writeToFile({ dir, filename: 'known_hosts', content: '' }); | ||||||
|  |   console.log('✅ [SSH] known_hosts file ensured', dir, filename, content); | ||||||
|   writeToFile({ dir, filename, content, isRequired: true }); |   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; |   return filePath; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dragan Filipovic
						Dragan Filipovic