mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 12:04:24 +02:00
Deduplicate nix
dependency versions (#12307)
# Description Now we only use `nix 0.28.0` Achieved by - updating `ctrlc` to `3.4.4` - updating `wl-clipboard-rs` to `0.8.1` - update our own dependency on `nix` from `0.27` to `0.28` - required fixing uses of `nix::unistd::{tcgetpgrp,tcsetpgrp}` - now requires an I/O safe file descriptor - fake one pointing to `libc::STDIN_FILENO` (we were only accessing `0` previously, dito for fish) # User-Facing Changes Better compile times and less to download as source dependencies
This commit is contained in:
committed by
GitHub
parent
bf8de9d1ea
commit
dfbbacfdf8
@@ -57,7 +57,7 @@ pub(crate) fn acquire(interactive: bool) {
|
||||
}
|
||||
}
|
||||
// Set our possibly new pgid to be in control of terminal
|
||||
let _ = unistd::tcsetpgrp(libc::STDIN_FILENO, shell_pgid);
|
||||
let _ = unistd::tcsetpgrp(unsafe { nu_system::stdin_fd() }, shell_pgid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ pub(crate) fn acquire(interactive: bool) {
|
||||
fn take_control() -> Pid {
|
||||
let shell_pgid = unistd::getpgrp();
|
||||
|
||||
match unistd::tcgetpgrp(nix::libc::STDIN_FILENO) {
|
||||
match unistd::tcgetpgrp(unsafe { nu_system::stdin_fd() }) {
|
||||
Ok(owner_pgid) if owner_pgid == shell_pgid => {
|
||||
// Common case, nothing to do
|
||||
return owner_pgid;
|
||||
@@ -91,14 +91,14 @@ fn take_control() -> Pid {
|
||||
}
|
||||
|
||||
for _ in 0..4096 {
|
||||
match unistd::tcgetpgrp(libc::STDIN_FILENO) {
|
||||
match unistd::tcgetpgrp(unsafe { nu_system::stdin_fd() }) {
|
||||
Ok(owner_pgid) if owner_pgid == shell_pgid => {
|
||||
// success
|
||||
return owner_pgid;
|
||||
}
|
||||
Ok(owner_pgid) if owner_pgid == Pid::from_raw(0) => {
|
||||
// Zero basically means something like "not owned" and we can just take it
|
||||
let _ = unistd::tcsetpgrp(libc::STDIN_FILENO, shell_pgid);
|
||||
let _ = unistd::tcsetpgrp(unsafe { nu_system::stdin_fd() }, shell_pgid);
|
||||
}
|
||||
Err(Errno::ENOTTY) => {
|
||||
eprintln!("ERROR: no TTY for interactive shell");
|
||||
@@ -123,7 +123,7 @@ extern "C" fn restore_terminal() {
|
||||
// `tcsetpgrp` and `getpgrp` are async-signal-safe
|
||||
let initial_pgid = Pid::from_raw(INITIAL_PGID.load(Ordering::Relaxed));
|
||||
if initial_pgid.as_raw() > 0 && initial_pgid != unistd::getpgrp() {
|
||||
let _ = unistd::tcsetpgrp(libc::STDIN_FILENO, initial_pgid);
|
||||
let _ = unistd::tcsetpgrp(unsafe { nu_system::stdin_fd() }, initial_pgid);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user