microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
flowey/flowey_cli/src/lib.rs
36lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | #![expect(missing_docs)] |
| 5 | #![forbid(unsafe_code)] |
| 6 | |
| 7 | use flowey_core::pipeline::IntoPipeline; |
| 8 | use std::path::Path; |
| 9 | |
| 10 | mod cli; |
| 11 | mod flow_resolver; |
| 12 | mod pipeline_resolver; |
| 13 | mod var_db; |
| 14 | |
| 15 | /// Entrypoint into generic flowey infrastructure. |
| 16 | pub fn flowey_main<ProjectPipelines: clap::Subcommand + IntoPipeline>( |
| 17 | flowey_crate: &str, |
| 18 | repo_root: &Path, |
| 19 | ) -> ! { |
| 20 | if let Err(e) = cli::cli_main::<ProjectPipelines>(flowey_crate, repo_root) { |
| 21 | log::error!("Error: {:#}", e); |
| 22 | std::process::exit(-1); |
| 23 | } else { |
| 24 | std::process::exit(0) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | fn running_in_wsl() -> bool { |
| 29 | let Ok(output) = std::process::Command::new("wslpath") |
| 30 | .args(["-aw", "/"]) |
| 31 | .output() |
| 32 | else { |
| 33 | return false; |
| 34 | }; |
| 35 | String::from_utf8_lossy(&output.stdout).starts_with(r"\\wsl.localhost") |
| 36 | } |
| 37 | |