Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backend/pkgx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ fn pkgx_arch_for_target(target: &PlatformTarget) -> String {
}
}

#[cfg(any(unix, test))]
fn shell_quote(value: &str) -> String {
format!("'{}'", value.replace('\'', "'\\''"))
}
Expand Down
3 changes: 2 additions & 1 deletion src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,8 @@ impl<'a> CmdLineRunner<'a> {
/// and discussion #9355.
#[cfg(windows)]
pub fn raw_arg<S: AsRef<OsStr>>(mut self, arg: S) -> Self {
use std::os::windows::process::CommandExt;
// tokio's `Command` exposes `raw_arg` as an inherent method, so the
// `std::os::windows::process::CommandExt` trait import is unnecessary.
self.cmd.raw_arg(arg);
self
}
Expand Down
4 changes: 3 additions & 1 deletion src/config/config_file/mise_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ impl MiseToml {
}

/// Set `[bootstrap.brew.taps]."<owner>/<tap>" = "<url>"`, creating the
/// tables as needed.
/// tables as needed. Only used by the `#[cfg(unix)]` brew CLI commands.
#[cfg(unix)]
pub fn update_bootstrap_brew_tap(&mut self, tap: &str, url: &str) -> eyre::Result<()> {
self.bootstrap
.get_or_insert_with(Default::default)
Expand Down Expand Up @@ -579,6 +580,7 @@ impl MiseToml {
Ok(())
}

#[cfg(unix)]
pub fn remove_bootstrap_brew_tap(&mut self, tap: &str) -> eyre::Result<()> {
if let Some(bootstrap) = &mut self.bootstrap {
bootstrap.brew.taps.shift_remove(tap);
Expand Down
2 changes: 2 additions & 0 deletions src/oci/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ mod tests {
assert!(entries_seen > 0, "expected at least one tar entry");
}

#[cfg(unix)]
fn assert_layer_mode(blob: &LayerBlob, expected_path: &str, expected_mode: u32) {
let decoder = flate2::read::GzDecoder::new(blob.bytes.as_slice());
let mut archive = tar::Archive::new(decoder);
Expand All @@ -720,6 +721,7 @@ mod tests {
panic!("expected layer entry {expected_path}");
}

#[cfg(unix)]
fn assert_layer_entry_owner(blob: &LayerBlob, expected_path: &str, uid: u64, gid: u64) {
let decoder = flate2::read::GzDecoder::new(blob.bytes.as_slice());
let mut archive = tar::Archive::new(decoder);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/core/erlang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl ErlangPlugin {
))
}

#[cfg(linux)]
fn linux_precompiled_cache_name(url: &str) -> String {
url.strip_prefix("https://builds.hex.pm/builds/otp/")
.unwrap_or(url)
Expand Down
2 changes: 2 additions & 0 deletions src/system/launchd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ fn current_uid() -> u32 {
0
}

#[cfg(unix)]
fn current_uid_from(euid: u32, sudo_uid: Option<&str>) -> u32 {
if euid == 0
&& let Some(uid) = sudo_uid.and_then(|uid| uid.parse::<u32>().ok())
Expand Down Expand Up @@ -464,6 +465,7 @@ mod tests {
assert!(plist_matches(&plist, &request));
}

#[cfg(unix)]
#[test]
fn test_current_uid_prefers_sudo_uid_for_root() {
assert_eq!(current_uid_from(0, Some("501")), 501);
Expand Down
3 changes: 3 additions & 0 deletions src/ui/progress_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ pub enum ProgressIcon {
Skipped,
#[allow(dead_code)]
Warning,
// Constructed only by the brew package managers (`#[cfg(unix)]`), so it reads
// as never-constructed on the windows build.
#[cfg_attr(windows, allow(dead_code))]
Error,
}

Expand Down
Loading