aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-client
diff options
context:
space:
mode:
authordivens <divens@users.noreply.github.com>2026-02-23 08:59:52 +0100
committerGitHub <noreply@github.com>2026-02-23 08:59:52 +0100
commitb3b4aa8ccbcdfcc9580c329f09bf2109841c783b (patch)
tree32ac7be664a31a2e8e7a28df697828fa04aa198b /zellij-client
parentfix: set scroll region to viewport size when resizing in alternate screen (#4... (diff)
downloadsl0ppij-b3b4aa8ccbcdfcc9580c329f09bf2109841c783b.tar.gz
sl0ppij-b3b4aa8ccbcdfcc9580c329f09bf2109841c783b.tar.xz
sl0ppij-b3b4aa8ccbcdfcc9580c329f09bf2109841c783b.zip
[Windows port PR6] refactor: gate daemonization and shell-related functions for cross-platform support (#4746)
* refactor: abstract daemonization behind cfg gates Gate Unix-only daemonize/nix usage with #[cfg(unix)], add non-Unix foreground fallback for web server, remove unused libc dep from both crates, and move daemonize/nix to cfg(unix) dependencies. * refactor: abstract shell invocation and process listing Gate get_default_shell() with cfg(not(windows)) and add a Windows stub. Split run_command_hook() with cfg(not(windows)) for the sh -c path and a Windows stub. Add cfg(unix) gate on the ps-based get_all_cmds_by_ppid() with a non-Unix stub. --------- Co-authored-by: divens <divens.dev@gmail.com>
Diffstat (limited to 'zellij-client')
-rw-r--r--zellij-client/Cargo.toml7
-rw-r--r--zellij-client/src/web_client/mod.rs20
2 files changed, 22 insertions, 5 deletions
diff --git a/zellij-client/Cargo.toml b/zellij-client/Cargo.toml
index bdcace07..4b0afc8a 100644
--- a/zellij-client/Cargo.toml
+++ b/zellij-client/Cargo.toml
@@ -22,14 +22,11 @@ tower-http = { version = "0.6.4", features = ["cors"], optional = true }
anyhow = { workspace = true }
async-trait = { workspace = true }
crossterm = { workspace = true }
-daemonize = { workspace = true }
dialoguer = { workspace = true }
interprocess = { workspace = true }
lazy_static = { workspace = true }
-libc = { workspace = true }
log = { workspace = true }
mio = { version = "0.8.11", default-features = false, features = ['os-ext'] }
-nix = { workspace = true }
notify = { workspace = true }
num_cpus = { workspace = true }
regex = { workspace = true }
@@ -51,6 +48,10 @@ urlencoding = "2.1"
[target.'cfg(not(windows))'.dependencies]
signal-hook = { workspace = true }
+[target.'cfg(unix)'.dependencies]
+daemonize = { workspace = true }
+nix = { workspace = true }
+
[dev-dependencies]
insta = "1.6.0"
serde_json = "1.0"
diff --git a/zellij-client/src/web_client/mod.rs b/zellij-client/src/web_client/mod.rs
index 0ef47302..958de439 100644
--- a/zellij-client/src/web_client/mod.rs
+++ b/zellij-client/src/web_client/mod.rs
@@ -28,11 +28,16 @@ use tokio::runtime::Runtime;
use axum_server::tls_rustls::RustlsConfig;
use axum_server::Handle;
+#[cfg(unix)]
use daemonize::{self, Outcome};
+#[cfg(unix)]
+use interprocess::unnamed_pipe::pipe;
+#[cfg(unix)]
use nix::sys::stat::{umask, Mode};
-use interprocess::unnamed_pipe::pipe;
-use std::io::{prelude::*, BufRead, BufReader};
+use std::io::prelude::*;
+#[cfg(unix)]
+use std::io::{BufRead, BufReader};
use zellij_utils::input::{config::Config, options::Options};
use authentication::auth_middleware;
@@ -247,6 +252,7 @@ pub async fn serve_web_client(
}
}
+#[cfg(unix)]
fn daemonize_web_server(
web_server_ip: IpAddr,
web_server_port: u16,
@@ -348,6 +354,16 @@ fn daemonize_web_server(
}
}
+#[cfg(not(unix))]
+fn daemonize_web_server(
+ _web_server_ip: IpAddr,
+ _web_server_port: u16,
+ _web_server_cert: Option<PathBuf>,
+ _web_server_key: Option<PathBuf>,
+) -> (Runtime, std::net::TcpListener, Option<RustlsConfig>) {
+ unimplemented!("Non-Unix web server not yet implemented")
+}
+
#[cfg(test)]
#[path = "./unit/web_client_tests.rs"]
mod web_client_tests;