xbp 10.13.0

XBP is a zero-config build pack that can also interact with proxies, kafka, sockets, synthetic monitors.
Documentation
//! pm2 process management module
//!
//! provides functions for managing pm2 processes
//! includes list stop delete start cleanup and save operations
//! supports log redirection to xbp/logs directories

use crate::sdk::pm2;
use std::collections::HashMap;
use std::path::PathBuf;

pub async fn pm2_list(debug: bool) -> Result<(), String> {
    pm2::list(debug).await
}

pub async fn pm2_logs(project: Option<String>, debug: bool) -> Result<(), String> {
    pm2::logs(project, debug).await
}

/// Stop a PM2 process by name
pub async fn pm2_stop(name: &str, debug: bool) -> Result<(), String> {
    pm2::stop(name, debug).await
}

/// Delete a PM2 process by name
pub async fn pm2_delete(name: &str, debug: bool) -> Result<(), String> {
    pm2::delete(name, debug).await
}

/// Start a PM2 process with the given command and name
pub async fn pm2_start(
    name: &str,
    command: &str,
    log_dir: Option<&PathBuf>,
    envs: Option<&HashMap<String, String>>,
    debug: bool,
) -> Result<(), String> {
    pm2::start(name, command, log_dir, envs, debug).await
}

/// Clean up stopped and errored PM2 processes
pub async fn pm2_cleanup(debug: bool) -> Result<(), String> {
    pm2::cleanup(debug).await
}

/// Save PM2 process list
pub async fn pm2_save(debug: bool) -> Result<(), String> {
    pm2::save(debug).await
}

pub async fn pm2_snapshot(debug: bool) -> Result<std::path::PathBuf, String> {
    pm2::snapshot(debug).await
}

pub async fn pm2_resurrect(debug: bool) -> Result<(), String> {
    pm2::resurrect(debug).await
}

pub async fn pm2_flush(target: Option<&str>, debug: bool) -> Result<(), String> {
    pm2::flush(target, debug).await
}

pub async fn pm2_monitor(debug: bool) -> Result<(), String> {
    pm2::monitor(debug).await
}

pub async fn pm2_env(target: &str, debug: bool) -> Result<(), String> {
    pm2::env(target, debug).await
}