microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
petri/pipette/src/main.rs
32lines · modecode
| 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 | |
| 7 | mod agent; |
| 8 | mod execute; |
| 9 | mod shutdown; |
| 10 | mod trace; |
| 11 | #[cfg(windows)] |
| 12 | mod winsvc; |
| 13 | |
| 14 | // This is here to satisfy rust-analyzer on macos. Pipette does not yet support |
| 15 | // macos. |
| 16 | #[cfg(target_os = "macos")] |
| 17 | fn main() -> anyhow::Result<()> { |
| 18 | anyhow::bail!("unsupported on macos") |
| 19 | } |
| 20 | |
| 21 | #[cfg(any(target_os = "linux", target_os = "windows"))] |
| 22 | fn 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(|driver| async move { |
| 29 | let agent = agent::Agent::new(driver).await?; |
| 30 | agent.run().await |
| 31 | }) |
| 32 | } |
| 33 | |