Refactor IPC and DTO structures; remove unused code and streamline message handling
- Removed unused structs and methods from `response.rs`, `usage.rs`, and `client.rs`. - Simplified `Connection` handling in `conn.rs` to only support Unix sockets. - Updated `IpcServer` to exclusively use Unix sockets and removed TCP handling. - Cleaned up `editlog.rs` by removing loading and recent entry methods. - Refactored `memory.rs` to eliminate unused functions related to lesson promotion and retrospective creation. - Enhanced `search.rs` to support multiple search providers and improved error handling. - Updated chat view logic to simplify message display and improve user experience. - Removed deprecated modules and constants from various files to streamline the codebase.
This commit is contained in:
@@ -28,11 +28,3 @@ pub fn bash_kill(id: &str) -> anyhow::Result<()> {
|
||||
anyhow::bail!("bash job '{}' not found", id)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register_bash_job(job: BashJob) -> String {
|
||||
let id = job.id.clone();
|
||||
if let Ok(mut map) = bash_jobs_map().lock() {
|
||||
map.insert(id.clone(), job);
|
||||
}
|
||||
id
|
||||
}
|
||||
|
||||
+1
-12
@@ -5,20 +5,16 @@ use std::io::BufRead;
|
||||
|
||||
pub struct BashJob {
|
||||
pub id: String,
|
||||
pub command: String,
|
||||
pub started_at: i64,
|
||||
pub output_rx: mpsc::Receiver<String>,
|
||||
pub exit_code: Option<i32>,
|
||||
pub handle: Option<thread::JoinHandle<()>>,
|
||||
}
|
||||
|
||||
pub fn spawn_bash_job(command: String) -> BashJob {
|
||||
let id = uuid::Uuid::new_v4().to_string();
|
||||
let started_at = chrono::Utc::now().timestamp_millis();
|
||||
let (output_tx, output_rx) = mpsc::channel::<String>();
|
||||
let cmd = command.clone();
|
||||
|
||||
let handle = thread::spawn(move || {
|
||||
let _handle = thread::spawn(move || {
|
||||
let child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(&cmd)
|
||||
@@ -46,11 +42,8 @@ pub fn spawn_bash_job(command: String) -> BashJob {
|
||||
|
||||
BashJob {
|
||||
id,
|
||||
command,
|
||||
started_at,
|
||||
output_rx,
|
||||
exit_code: None,
|
||||
handle: Some(handle),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +61,4 @@ impl BashJob {
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_running(&self) -> bool {
|
||||
self.exit_code.is_none()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user