1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

Make procinfo's lua dependency optional

This commit is contained in:
K Simmons 2022-09-01 16:01:15 -07:00 committed by Wez Furlong
parent dbacf98b89
commit 6166008b18
2 changed files with 12 additions and 4 deletions

View File

@ -4,12 +4,15 @@ version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["lua"]
lua = ["dep:luahelper", "dep:wezterm-dynamic"]
[dependencies]
libc = "0.2"
log = "0.4"
luahelper = { path = "../luahelper" }
wezterm-dynamic = { path = "../wezterm-dynamic" }
luahelper = { path = "../luahelper", optional = true }
wezterm-dynamic = { path = "../wezterm-dynamic", optional = true }
[target."cfg(windows)".dependencies]
ntapi = "0.3"

View File

@ -1,12 +1,15 @@
use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
#[cfg(feature = "lua")]
use wezterm_dynamic::{FromDynamic, ToDynamic};
mod linux;
mod macos;
mod windows;
#[derive(Debug, Copy, Clone, FromDynamic, ToDynamic)]
#[derive(Debug, Copy, Clone)]
#[cfg_attr(feature = "lua", derive(FromDynamic, ToDynamic))]
pub enum LocalProcessStatus {
Idle,
Run,
@ -22,7 +25,8 @@ pub enum LocalProcessStatus {
Unknown,
}
#[derive(Debug, Clone, FromDynamic, ToDynamic)]
#[derive(Debug, Clone)]
#[cfg_attr(feature = "lua", derive(FromDynamic, ToDynamic))]
pub struct LocalProcessInfo {
/// The process identifier
pub pid: u32,
@ -55,6 +59,7 @@ pub struct LocalProcessInfo {
/// Child processes, keyed by pid
pub children: HashMap<u32, LocalProcessInfo>,
}
#[cfg(feature = "lua")]
luahelper::impl_lua_conversion_dynamic!(LocalProcessInfo);
impl LocalProcessInfo {