mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 23:22:32 +02:00
Foreground process group management, again (#6584)
* Revert "Revert "Try again: in unix like system, set foreground process while running external command (#6273)" (#6542)"
This reverts commit 2bb367f570
.
* Make foreground job control hopefully work correctly
These changes are mostly inspired by the glibc manual.
* Fix typo in external command description
* Only restore tty control to shell when no fg procs are left; reuse pgrp
* Rework terminal acquirement code to be like fish
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
@ -10,7 +10,10 @@ use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet, VecDeque},
|
||||
sync::{atomic::AtomicBool, Arc, Mutex},
|
||||
sync::{
|
||||
atomic::{AtomicBool, AtomicU32},
|
||||
Arc, Mutex,
|
||||
},
|
||||
};
|
||||
|
||||
static PWD_ENV: &str = "PWD";
|
||||
@ -80,6 +83,7 @@ pub struct EngineState {
|
||||
pub env_vars: EnvVars,
|
||||
pub previous_env_vars: HashMap<String, Value>,
|
||||
pub config: Config,
|
||||
pub pipeline_externals_state: Arc<(AtomicU32, AtomicU32)>,
|
||||
pub repl_buffer_state: Arc<Mutex<Option<String>>>,
|
||||
pub repl_operation_queue: Arc<Mutex<VecDeque<ReplOperation>>>,
|
||||
#[cfg(feature = "plugin")]
|
||||
@ -121,6 +125,7 @@ impl EngineState {
|
||||
env_vars: EnvVars::from([(DEFAULT_OVERLAY_NAME.to_string(), HashMap::new())]),
|
||||
previous_env_vars: HashMap::new(),
|
||||
config: Config::default(),
|
||||
pipeline_externals_state: Arc::new((AtomicU32::new(0), AtomicU32::new(0))),
|
||||
repl_buffer_state: Arc::new(Mutex::new(None)),
|
||||
repl_operation_queue: Arc::new(Mutex::new(VecDeque::new())),
|
||||
#[cfg(feature = "plugin")]
|
||||
|
Reference in New Issue
Block a user