Skip to content

Commit c26e52c

Browse files
committed
enable progress bar for FreeBSD
As FreeBSD uses a unsigned long for the IOCTL syscall this code would previously fail to compile. Adding a call to into() fixes this problem. This code should still work on other platfroms as into() is able to 'convert' an u32 into a u32. Also change the cfg attributes so that the working code is used. This may also work on other not yet supported platforms, but it was not tested.
1 parent 375de4a commit c26e52c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: src/cargo/core/shell.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl ColorChoice {
366366
}
367367
}
368368

369-
#[cfg(any(target_os = "linux", target_os = "macos"))]
369+
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
370370
mod imp {
371371
use std::mem;
372372

@@ -377,7 +377,7 @@ mod imp {
377377
pub fn stderr_width() -> Option<usize> {
378378
unsafe {
379379
let mut winsize: libc::winsize = mem::zeroed();
380-
if libc::ioctl(libc::STDERR_FILENO, libc::TIOCGWINSZ, &mut winsize) < 0 {
380+
if libc::ioctl(libc::STDERR_FILENO, libc::TIOCGWINSZ.into(), &mut winsize) < 0 {
381381
return None;
382382
}
383383
if winsize.ws_col > 0 {
@@ -396,7 +396,10 @@ mod imp {
396396
}
397397
}
398398

399-
#[cfg(all(unix, not(any(target_os = "linux", target_os = "macos"))))]
399+
#[cfg(all(
400+
unix,
401+
not(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))
402+
))]
400403
mod imp {
401404
pub(super) use super::default_err_erase_line as err_erase_line;
402405

0 commit comments

Comments
 (0)