simple command exists

This commit is contained in:
Dragan Filipovic 2023-01-02 02:01:20 +01:00
parent 8e3c961ec3
commit 6e50b54a1b
4 changed files with 15 additions and 32 deletions

View file

@ -1,11 +1,16 @@
const { execSync } = require('child_process');
const which = require('which');
const nodeRsync = require('rsyncwrapper');
// eslint-disable-next-line no-async-promise-executor
const validateRsync = new Promise(async (resolve, reject) => {
const rsyncCli = await which('rsync', { nothrow: true });
execSync('rsync --version', { stdio: 'inherit' });
let rsyncCli = false;
try {
execSync('rsync --version', { stdio: 'inherit' });
rsyncCli = true;
} catch (e) {
rsyncCli = true;
}
if (rsyncCli) {
console.log('⚠️ [CLI] Rsync exists');
execSync('rsync --version', { stdio: 'inherit' });