5 ms·
Just to be sure I'm getting the question - you want to use rsync(1), and you're wondering if there's a good way to guard your code that's using/calling it from
by techcode 6y ago
Just to be sure I'm getting the question - you want to use rsync(1), and you're wondering if there's a good way to guard your code that's using/calling it from underlying changes in rsync options and output, how to read status/progress and such?
Here's an example of library that wraps rsync https://metacpan.org/pod/File::Rsync https://metacpan.org/pod/File::Rsync - you can provide callback functions that will be called for each line of stdout/stderr.
Granted it's in Perl - and chances are your code isn't written in Perl. So if you can't find something similar for your language of choice, and if you can't be bothered with checking out implementation in Perl and rewriting it...
I would suggest searching & checking out "Inline::" namespace (e.g.: https://metacpan.org/pod/distribution/Inline-Java/lib/Inline/Java.pod https://metacpan.org/pod/distribution/Inline-Java/lib/Inline..., and there's also JS, C ...etc).
And next to those - Perlito can "Compile Perl to Java/JavaScript/Python/Ruby/Go/etc" https://github.com/fglock/Perlito https://github.com/fglock/Perlito. I think we had/have some Perl code running in production Hadoop/JVM.