pipette/
main.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! This is the petri pipette agent, which runs on the guest and executes
5//! commands and other requests from the host.
6
7mod agent;
8mod execute;
9mod shutdown;
10mod trace;
11#[cfg(windows)]
12mod winsvc;
13
14// This is here to satisfy rust-analyzer on macos. Pipette does not yet support
15// macos.
16#[cfg(target_os = "macos")]
17fn main() -> anyhow::Result<()> {
18    anyhow::bail!("unsupported on macos")
19}
20
21#[cfg(any(target_os = "linux", target_os = "windows"))]
22fn main() -> anyhow::Result<()> {
23    #[cfg(windows)]
24    if std::env::args().nth(1).as_deref() == Some("--service") {
25        return winsvc::start_service();
26    }
27
28    pal_async::DefaultPool::run_with(async |driver| {
29        let agent = agent::Agent::new(driver).await?;
30        agent.run().await
31    })
32}