microsoft/openvmm

Public

mirrored fromhttps://github.com/microsoft/openvmmAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/apply-async-process-wait-functionality

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

flowey/flowey_lib_common/src/_util/mod.rs

33lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4pub use flowey::util::copy_dir_all;
5
6use flowey::node::prelude::FlowPlatformKind;
7use flowey::node::prelude::RustRuntimeServices;
8
9pub mod cargo_output;
10pub mod extract;
11pub mod wslpath;
12
13// include a "dummy" _rt argument to enforce that this helper should only be
14// used in runtime contexts, and not during flow compile-time.
15pub fn running_in_wsl(_rt: &mut RustRuntimeServices<'_>) -> bool {
16 let Ok(output) = std::process::Command::new("wslpath")
17 .args(["-aw", "/"])
18 .output()
19 else {
20 return false;
21 };
22 String::from_utf8_lossy(&output.stdout).starts_with(r"\\wsl.localhost")
23}
24
25/// Returns the name of the bsdtar binary to use. On Windows, this is just the
26/// inbox tar.exe. Elsewhere, use bsdtar. This will require installing the
27/// libarchive-tools package on Debian-based Linux.
28pub fn bsdtar_name(rt: &mut RustRuntimeServices<'_>) -> &'static str {
29 match rt.platform().kind() {
30 FlowPlatformKind::Windows => "tar.exe",
31 FlowPlatformKind::Unix => "bsdtar",
32 }
33}
34