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 { pub trait LogRunnable {
fn run(&mut self, logger: &Logger) -> Result<(), SpecificExecutionError>; fn run(&mut self, logger: &Logger) -> Result<(), SpecificExecutionError>;
fn collect_output(&mut self) -> Result<Output, SpecificExecutionError>; fn collect_output(&mut self) -> Result<Output, SpecificExecutionError>;
//TODO collect_full_output
} }
impl LogRunnable for Command { impl LogRunnable for Command {

View File

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