mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 05:27:45 +00:00
Merge pull request #465 from Arcterus/master
nohup: fix build on Macs (closes #463)
This commit is contained in:
commit
26ea65a746
1 changed files with 0 additions and 13 deletions
|
@ -33,20 +33,9 @@ extern {
|
||||||
fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int;
|
fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
fn rewind_stdout(s: Fd) {
|
|
||||||
match s.seek(0, io::SeekEnd) {
|
|
||||||
Ok(_) => {}
|
|
||||||
Err(f) => crash!(1, "{}", f.detail.into_inner())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { std::ptr::null() }
|
unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { std::ptr::null() }
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
|
||||||
fn rewind_stdout(_: Fd) {}
|
|
||||||
|
|
||||||
pub fn uumain(args: Vec<String>) -> int {
|
pub fn uumain(args: Vec<String>) -> int {
|
||||||
let program = &args[0];
|
let program = &args[0];
|
||||||
|
|
||||||
|
@ -108,8 +97,6 @@ fn replace_fds() {
|
||||||
let new_stdout = find_stdout();
|
let new_stdout = find_stdout();
|
||||||
let fd = new_stdout.as_raw_fd();
|
let fd = new_stdout.as_raw_fd();
|
||||||
|
|
||||||
rewind_stdout(fd);
|
|
||||||
|
|
||||||
if unsafe { dup2(fd, 1) } != 1 {
|
if unsafe { dup2(fd, 1) } != 1 {
|
||||||
crash!(2, "Cannot replace STDOUT: {}", std::io::IoError::last_error())
|
crash!(2, "Cannot replace STDOUT: {}", std::io::IoError::last_error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue