Skip to content

Commit

Permalink
Auto merge of #8054 - jclulow:unix-progress, r=alexcrichton
Browse files Browse the repository at this point in the history
enable progress bar on all UNIX platforms

The progress bar rendered at the base of ongoing output from Cargo is presently only drawn on a subset of UNIX platforms: FreeBSD, Linux, and Mac OS.  The functionality required is basic, and essentially universally available: `ioctl()`, `TIOCGWINSZ`, and `STDERR_FILENO`.

When your platform is not in this list, the difference in behaviour is subtle and the exact mechanism is difficult to locate.  It would be better to fail to build on new ports until these definitions become available in the libc crate for those platforms.
  • Loading branch information
bors committed Mar 30, 2020
2 parents 5ba0ecc + 53094e3 commit 536ce93
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions src/cargo/core/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl ColorChoice {
}
}

#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
#[cfg(unix)]
mod imp {
use super::Shell;
use std::mem;
Expand Down Expand Up @@ -408,18 +408,6 @@ mod imp {
}
}

#[cfg(all(
unix,
not(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))
))]
mod imp {
pub(super) use super::default_err_erase_line as err_erase_line;

pub fn stderr_width() -> Option<usize> {
None
}
}

#[cfg(windows)]
mod imp {
use std::{cmp, mem, ptr};
Expand Down Expand Up @@ -476,13 +464,7 @@ mod imp {
}
}

#[cfg(any(
all(
unix,
not(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))
),
windows,
))]
#[cfg(windows)]
fn default_err_erase_line(shell: &mut Shell) {
if let Some(max_width) = imp::stderr_width() {
let blank = " ".repeat(max_width);
Expand Down

0 comments on commit 536ce93

Please sign in to comment.