__builtin_unreachable();
}
-
- SystemCmd::Args
- shellify_pipe(const SystemCmd::Args& args1, const Shell& shell2, const SystemCmd::Args& args2)
+ string _wrap_shell_args(const Shell& shell, const SystemCmd::Args& args)
{
- string tmp1 = quote(args1);
- string tmp2 = quote(args2);
-
- switch (shell2.mode)
+ string tmp = quote(args);
+ switch (shell.mode)
{
case Shell::Mode::DIRECT:
- {
- return SystemCmd::Args { SH_BIN, "-c", tmp1 + " | " + tmp2 };
- }
+ return tmp;
case Shell::Mode::SSH:
- {
- return SystemCmd::Args { SH_BIN, "-c", tmp1 + " | " + SSH_BIN " " +
- quote(shell2.ssh_options) + " " + quote(tmp2) };
- }
+ return SSH_BIN " " + quote(shell.ssh_options) + " " + quote(tmp);
}
SN_THROW(Exception("invalid shell mode"));
__builtin_unreachable();
}
+ SystemCmd::Args
+ shellify_pipe(const Shell& shell1, const SystemCmd::Args& args1,
+ const Shell& shell2, const SystemCmd::Args& args2)
+ {
+ return { SH_BIN, "-c", _wrap_shell_args(shell1, args1) + " | " +
+ _wrap_shell_args(shell2, args2) };
+ }
+
}
SystemCmd::Args
- shellify_pipe(const SystemCmd::Args& args1, const Shell& shell2, const SystemCmd::Args& args2);
+ shellify_pipe(const Shell& shell1, const SystemCmd::Args& args1,
+ const Shell& shell2, const SystemCmd::Args& args2);
}
y2deb("source: " << cmd3a_args.get_values());
y2deb("target: " << cmd3b_args.get_values());
- SystemCmd cmd3(shellify_pipe(cmd3a_args, backup_config.get_target_shell(), cmd3b_args));
+ SystemCmd cmd3(shellify_pipe(backup_config.get_source_shell(), cmd3a_args,
+ backup_config.get_target_shell(), cmd3b_args));
if (cmd3.retcode() != 0)
{
y2err("command '" << cmd3.cmd() << "' failed: " << cmd3.retcode());