mirror of
https://github.com/BloopAI/vibe-kanban.git
synced 2026-11-29 00:00:37 +00:00
commitca21aa4016Author: Louis Knight-Webb <louis@bloop.ai> Date: Tue Jun 24 16:50:43 2025 +0100 Fixes commit75c982209aAuthor: Louis Knight-Webb <louis@bloop.ai> Date: Tue Jun 24 16:35:58 2025 +0100 Improve process killing commitf58fd3b8a3Author: Louis Knight-Webb <louis@bloop.ai> Date: Tue Jun 24 16:23:59 2025 +0100 WIP commit7a6cd4772eAuthor: Louis Knight-Webb <louis@bloop.ai> Date: Tue Jun 24 12:34:13 2025 +0100 Fix dev server activity not showing commit09eb3095c1Author: Louis Knight-Webb <louis@bloop.ai> Date: Tue Jun 24 12:27:01 2025 +0100 Add activity for dev server commit73db9a2031Author: Louis Knight-Webb <louis@bloop.ai> Date: Tue Jun 24 12:04:38 2025 +0100 Lint commit0a0ad90177Author: Louis Knight-Webb <louis@bloop.ai> Date: Tue Jun 24 12:01:37 2025 +0100 WIP dev server
45 lines
1.2 KiB
Rust
45 lines
1.2 KiB
Rust
use async_trait::async_trait;
|
|
use tokio::process::{Child, Command};
|
|
use uuid::Uuid;
|
|
|
|
use crate::executor::{Executor, ExecutorError};
|
|
use crate::models::project::Project;
|
|
use crate::models::task::Task;
|
|
|
|
/// Executor for running project setup scripts
|
|
pub struct SetupScriptExecutor {
|
|
pub script: String,
|
|
}
|
|
|
|
#[async_trait]
|
|
impl Executor for SetupScriptExecutor {
|
|
async fn spawn(
|
|
&self,
|
|
pool: &sqlx::SqlitePool,
|
|
task_id: Uuid,
|
|
worktree_path: &str,
|
|
) -> Result<Child, ExecutorError> {
|
|
// Validate the task and project exist
|
|
let task = Task::find_by_id(pool, task_id)
|
|
.await?
|
|
.ok_or(ExecutorError::TaskNotFound)?;
|
|
|
|
let _project = Project::find_by_id(pool, task.project_id)
|
|
.await?
|
|
.ok_or(ExecutorError::TaskNotFound)?; // Reuse TaskNotFound for simplicity
|
|
|
|
let child = Command::new("bash")
|
|
.kill_on_drop(true)
|
|
.stdout(std::process::Stdio::piped())
|
|
.stderr(std::process::Stdio::piped())
|
|
.arg("-c")
|
|
.arg(&self.script)
|
|
.current_dir(worktree_path)
|
|
.process_group(0)
|
|
.spawn()
|
|
.map_err(ExecutorError::SpawnFailed)?;
|
|
|
|
Ok(child)
|
|
}
|
|
}
|