Files
AstralRinth/packages/app-lib/src/api/process.rs
Geometrically 910e219c0e 0.8.0 beta fixes (#2154)
* initial fixes

* 0.8.0 beta fixes

* run actions

* run fmt

* Fix windows build

* Add purge cache opt

* add must revalidate to project req

* lint + clippy

* fix processes, open folder

* Update migrator to use old launcher cache for perf

* fix empty dirs not moving

* fix lint + create natives dir if not exist

* fix large request batches

* finish

* Fix deep linking on mac

* fix comp err

* fix comp err (2)

---------

Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-08-16 23:20:11 -07:00

50 lines
1.3 KiB
Rust

//! Theseus process management interface
use crate::state::ProcessMetadata;
pub use crate::{
state::{Hooks, MemorySettings, Profile, Settings, WindowSize},
State,
};
use uuid::Uuid;
// Gets the Profile paths of each *running* stored process in the state
#[tracing::instrument]
pub async fn get_all() -> crate::Result<Vec<ProcessMetadata>> {
let state = State::get().await?;
let processes = state.process_manager.get_all();
Ok(processes)
}
// Gets the UUID of each stored process in the state by profile path
#[tracing::instrument]
pub async fn get_by_profile_path(
profile_path: &str,
) -> crate::Result<Vec<ProcessMetadata>> {
let state = State::get().await?;
let processes = state
.process_manager
.get_all()
.into_iter()
.filter(|x| x.profile_path == profile_path)
.collect();
Ok(processes)
}
// Kill a child process stored in the state by UUID, as a string
#[tracing::instrument]
pub async fn kill(uuid: Uuid) -> crate::Result<()> {
let state = State::get().await?;
state.process_manager.kill(uuid).await?;
Ok(())
}
// Wait for a child process stored in the state by UUID
#[tracing::instrument]
pub async fn wait_for(uuid: Uuid) -> crate::Result<()> {
let state = State::get().await?;
state.process_manager.wait_for(uuid).await?;
Ok(())
}