Add remaining TODOs

This commit is contained in:
Leonard Steppy 2025-02-03 02:19:01 +01:00
parent 6e4a23254a
commit 930e02d802
2 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@ use std::process::{Command, ExitStatus, Output};
pub trait LogRunnable {
fn run(&mut self, logger: &Logger) -> Result<(), SpecificExecutionError>;
fn collect_output(&mut self) -> Result<Output, SpecificExecutionError>;
//TODO collect_full_output
}
impl LogRunnable for Command {

View File

@ -208,6 +208,7 @@ fn main() -> Result<(), String> {
Some(file_server) => match &file_server.address {
ServerAddress::Ssh { ssh_address } => {
//canonicalize remote files
//TODO only join when there are multiple paths
let joined_files = osf!("{{")
+ files
.iter()
@ -215,6 +216,8 @@ fn main() -> Result<(), String> {
.collect::<Vec<_>>()
.join(&OsString::from(","))
+ "}";
//TODO handle bad exit status
let realpath_output = ShellCmd::new("ssh")
.arg(ssh_address)
.arg(osf!("realpath ") + file_server.server_directory_path.join(joined_files))
@ -225,6 +228,7 @@ fn main() -> Result<(), String> {
.split(|&b| b == b'\n') //split at line breaks
.map(|bytes| PathBuf::from(OsStr::from_bytes(bytes)))
.collect();
log!(logger, debug, "canonical files: {files:?}");
for file in &files {
check_file_exists_on_server(file, ssh_address, &file_server.server_directory_path)?;
@ -587,7 +591,7 @@ where
error: ExecutionError::BadExitStatus(_), //test failed
..
}) => Err(format!(
"File '{}' doesn't exist on file server",
"File '{}' doesn't exist on file-server",
full_path.to_string_lossy()
)),
Err(e) => Err(format!(