add onStderr and onStdout

This commit is contained in:
Dragan Filipovic 2023-01-02 18:19:19 +01:00
parent 1eac106a16
commit 2b4b55bbb6
2 changed files with 4 additions and 4 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,5 @@
const { execSync } = require('child_process'); const { execSync } = require('child_process');
const nodeRsync = require('rsyncwrapper'); const nodeRsync = require('rsyncwrapper');
const { writeToFile } = require('./helpers');
const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => { const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
try { try {
@ -26,7 +25,7 @@ const validateRsync = async () => {
console.log('⚠️ [CLI] Rsync exists'); console.log('⚠️ [CLI] Rsync exists');
return; return;
} catch (error) { } catch (error) {
console.log('⚠️ [CLI] Rsync doesn\'t exists', error); console.log('⚠️ [CLI] Rsync doesn\'t exists', error.message);
} }
console.log('⚠️ [CLI] Start rsync installation with "apt-get" \n'); console.log('⚠️ [CLI] Start rsync installation with "apt-get" \n');
@ -55,7 +54,8 @@ const rsyncCli = async ({
return nodeRsyncPromise({ return nodeRsyncPromise({
...defaultOptions, ...defaultOptions,
src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort, src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort,
privateKey: privateKeyPath, args, sshCmdArgs privateKey: privateKeyPath, args, sshCmdArgs,
onStdout: (data) => console.log(data), onStderr: (data) => console.error(data)
}); });
}; };