mirror of
https://github.com/hanzoai/codex.git
synced 2026-10-30 14:59:26 +00:00
## What changed - Add the `codex-windows-sandbox-service` workspace crate and Windows-only build target. - Integrate `CodexSandboxService` with the Windows Service Control Manager, including start, stop, shutdown, status reporting, and event-log handling. - Support service mode by default and a debug-only `--foreground` mode. Keep provisioning IPC disabled until authenticated request handling is available. ## Testing - Add argument-parsing tests for service, foreground, unknown, and multiple arguments. GitOrigin-RevId: 1c84f0a593b65e5cf97ab7606cde03675542b0b0
23 lines
760 B
Rust
23 lines
760 B
Rust
use anyhow::Result;
|
|
use codex_windows_sandbox_service::RunMode;
|
|
|
|
fn main() -> Result<()> {
|
|
codex_windows_sandbox_service::run(parse_mode(std::env::args().skip(1))?)
|
|
}
|
|
|
|
fn parse_mode(arguments: impl Iterator<Item = String>) -> Result<RunMode> {
|
|
let arguments = arguments.collect::<Vec<_>>();
|
|
match arguments.as_slice() {
|
|
[] => Ok(RunMode::Service),
|
|
[argument] if argument == "--service" => Ok(RunMode::Service),
|
|
#[cfg(debug_assertions)]
|
|
[argument] if argument == "--foreground" => Ok(RunMode::Foreground),
|
|
[argument] => anyhow::bail!("unrecognized service argument {argument:?}"),
|
|
_ => anyhow::bail!("expected at most one service argument"),
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "main_tests.rs"]
|
|
mod tests;
|