dk_runner/executor/
mod.rs1pub mod process;
2pub mod container;
3
4use std::collections::HashMap;
5use std::path::Path;
6use std::time::Duration;
7
8#[derive(Debug, Clone, PartialEq)]
9pub enum StepStatus {
10 Pass,
11 Fail,
12 Skip,
13 Timeout,
14}
15
16impl StepStatus {
17 pub fn as_str(&self) -> &'static str {
18 match self {
19 Self::Pass => "pass",
20 Self::Fail => "fail",
21 Self::Skip => "skip",
22 Self::Timeout => "timeout",
23 }
24 }
25}
26
27#[derive(Debug, Clone)]
28pub struct StepOutput {
29 pub status: StepStatus,
30 pub stdout: String,
31 pub stderr: String,
32 pub duration: Duration,
33}
34
35#[async_trait::async_trait]
36pub trait Executor: Send + Sync {
37 async fn run_command(
38 &self,
39 command: &str,
40 work_dir: &Path,
41 timeout: Duration,
42 env: &HashMap<String, String>,
43 ) -> StepOutput;
44}