feat(sdk,plugins): API publique d'accès fichiers/workspace + analyse structure (#124,#129)
This commit is contained in:
@ -9,7 +9,9 @@
|
||||
use async_trait::async_trait;
|
||||
use tokio::process::Command;
|
||||
|
||||
use domain::ports::{ExitStatus, Output, ProcessError, ProcessSpawner, SpawnSpec};
|
||||
use domain::ports::{
|
||||
EnvironmentReader, ExitStatus, Output, ProcessError, ProcessSpawner, SpawnSpec,
|
||||
};
|
||||
|
||||
/// Process spawner backed by the local OS via `tokio::process::Command`.
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
@ -23,6 +25,24 @@ impl LocalProcessSpawner {
|
||||
}
|
||||
}
|
||||
|
||||
/// Environment reader backed by the local process environment.
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
pub struct LocalEnvironmentReader;
|
||||
|
||||
impl LocalEnvironmentReader {
|
||||
/// Creates a new [`LocalEnvironmentReader`].
|
||||
#[must_use]
|
||||
pub const fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl EnvironmentReader for LocalEnvironmentReader {
|
||||
fn get(&self, name: &str) -> Option<String> {
|
||||
std::env::var(name).ok()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ProcessSpawner for LocalProcessSpawner {
|
||||
async fn run(&self, spec: SpawnSpec) -> Result<Output, ProcessError> {
|
||||
|
||||
Reference in New Issue
Block a user