ssh-client-wrapper 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/rsyncExec.js +8 -3
- package/package.json +1 -1
package/lib/rsyncExec.js
CHANGED
|
@@ -116,10 +116,15 @@ async function isNewRsync(hostInfo) {
|
|
|
116
116
|
*/
|
|
117
117
|
export async function recv(hostInfo, argSrc, dst, rsyncOpt, timeout, retryableExitCodes, replaceRetryableExitCodes) {
|
|
118
118
|
await connect(hostInfo);
|
|
119
|
-
|
|
119
|
+
//pass each source as its own "host:path" argument. Joining them into one
|
|
120
|
+
//space separated argument relies on the remote shell to split it, which
|
|
121
|
+
//rsync >= 3.4 (protected args) no longer does.
|
|
122
|
+
const src = argSrc.map((e)=>{
|
|
123
|
+
return `${hostInfo.host}:${e}`;
|
|
124
|
+
});
|
|
120
125
|
const sshArgs = getSshOption(hostInfo, true);
|
|
121
126
|
const rshOpt = ["-e", `${sshCmd} ${sshArgs.join(" ")}`];
|
|
122
|
-
const args = ["-avv", "--copy-unsafe-links", ...rshOpt, ...rsyncOpt, src, dst];
|
|
127
|
+
const args = ["-avv", "--copy-unsafe-links", ...rshOpt, ...rsyncOpt, ...src, dst];
|
|
123
128
|
if (await isNewRsync(hostInfo)) {
|
|
124
129
|
args.unshift("--old-args");
|
|
125
130
|
}
|
|
@@ -128,7 +133,7 @@ export async function recv(hostInfo, argSrc, dst, rsyncOpt, timeout, retryableEx
|
|
|
128
133
|
const dstDir = argSrc.len > 1 || hasMagic(argSrc[0]) ? dst : path.dirname(dst);
|
|
129
134
|
await fs.mkdir(dstDir, { recursive: true });
|
|
130
135
|
|
|
131
|
-
debug(`recv ${src} to ${dst}`);
|
|
136
|
+
debug(`recv ${src.join(" ")} to ${dst}`);
|
|
132
137
|
debugVerbose(`recv: ${rsyncCmd} ${args.join(" ")}`);
|
|
133
138
|
const exitCodes = resolveRetryableExitCodes(hostInfo, retryableExitCodes, replaceRetryableExitCodes);
|
|
134
139
|
return retryWrapper(fork.bind(null, hostInfo, rsyncCmd, args, timeout, null, exitCodes), hostInfo);
|