From 5e31fa33c3b5cf726a57a063b8e7a070869250fe Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 19 May 2026 21:46:01 +0900 Subject: fix(compile): fix more random compile errors Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/shirabe/src/util/perforce.rs | 38 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'crates/shirabe/src/util/perforce.rs') diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs index a647dbb..d4d39ea 100644 --- a/crates/shirabe/src/util/perforce.rs +++ b/crates/shirabe/src/util/perforce.rs @@ -29,12 +29,12 @@ pub struct Perforce { pub(crate) p4_client_spec: String, pub(crate) p4_depot_type: Option, pub(crate) p4_branch: Option, - pub(crate) process: ProcessExecutor, + pub(crate) process: std::rc::Rc>, pub(crate) unique_perforce_client_name: String, pub(crate) windows_flag: bool, pub(crate) command_result: String, pub(crate) io: Box, - pub(crate) filesystem: Option, + pub(crate) filesystem: Option>>, } impl Perforce { @@ -43,7 +43,7 @@ impl Perforce { repo_config: IndexMap, port: String, path: String, - process: ProcessExecutor, + process: std::rc::Rc>, is_windows: bool, io: Box, ) -> Self { @@ -75,7 +75,7 @@ impl Perforce { repo_config: IndexMap, port: String, path: String, - process: ProcessExecutor, + process: std::rc::Rc>, io: Box, ) -> Self { Self::new(repo_config, port, path, process, Platform::is_windows(), io) @@ -83,7 +83,7 @@ impl Perforce { pub fn check_server_exists(url: &str, process_executor: &mut ProcessExecutor) -> bool { let mut ignored_output = String::new(); - process_executor.execute( + process_executor.execute_args( &vec![ "p4".to_string(), "-p".to_string(), @@ -152,7 +152,7 @@ impl Perforce { )); let client_spec = self.get_p4_client_spec(); let file_system = self.get_filesystem(); - file_system.remove(&client_spec); + file_system.borrow_mut().remove(&client_spec); } /// @param non-empty-string|non-empty-list $command @@ -168,7 +168,8 @@ impl Perforce { _ => vec![], }; self.process - .execute(&cmd_vec, &mut self.command_result, None) + .borrow_mut() + .execute_args(&cmd_vec, &mut self.command_result, None) } pub fn get_client(&mut self) -> String { @@ -195,7 +196,7 @@ impl Perforce { pub fn initialize_path(&mut self, path: &str) { self.path = path.to_string(); let fs = self.get_filesystem(); - fs.ensure_directory_exists(path); + fs.borrow_mut().ensure_directory_exists(path); } pub(crate) fn get_port(&self) -> &str { @@ -361,7 +362,7 @@ impl Perforce { .collect(), )); if exit_code != 0 { - let error_output = self.process.get_error_output().to_string(); + let error_output = self.process.borrow().get_error_output().to_string(); let user = self.get_user().unwrap_or_default(); let index = strpos(&error_output, &user); if index.is_none() { @@ -401,7 +402,7 @@ impl Perforce { file_get_contents(&self.get_p4_client_spec()), None, ); - process.run(None, IndexMap::new()); + process.run(None); } pub fn sync_code_base(&mut self, source_reference: Option<&str>) -> Result<()> { @@ -558,7 +559,7 @@ impl Perforce { None, ); - process.run(None, IndexMap::new()) + process.run(None) } pub fn p4_login(&mut self) -> Result<()> { @@ -583,11 +584,14 @@ impl Perforce { password, None, ); - process.run(None, IndexMap::new()); + process.run(None); if !process.is_successful() { return Err(Exception { - message: format!("Error logging in:{}", self.process.get_error_output()), + message: format!( + "Error logging in:{}", + self.process.borrow().get_error_output() + ), code: 0, } .into()); @@ -847,15 +851,17 @@ impl Perforce { Some(self.command_result.clone()) } - pub fn get_filesystem(&mut self) -> &Filesystem { + pub fn get_filesystem(&mut self) -> &std::rc::Rc> { if self.filesystem.is_none() { - self.filesystem = Some(Filesystem::new(&self.process)); + self.filesystem = Some(std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new( + Some(std::rc::Rc::clone(&self.process)), + )))); } self.filesystem.as_ref().unwrap() } - pub fn set_filesystem(&mut self, fs: Filesystem) { + pub fn set_filesystem(&mut self, fs: std::rc::Rc>) { self.filesystem = Some(fs); } -- cgit v1.3.1