mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Do not attempt to take control of terminal in non-interactive mode (#9693)
# Description
Fixes a regression from #9681 where nushell will attempt to place itself
into the background or take control of the terminal even in
non-interactive mode.
Using the same
[reference](https://www.gnu.org/software/libc/manual/html_node/Initializing-the-Shell.html)
from #6584:
>A subshell that runs *interactively* has to ensure that it has been
placed in the foreground...
>A subshell that runs *non-interactively* cannot and should not support
job control.
`fish`
[code](54fa1ad6ec/src/reader.cpp (L4862)
)
also seems to follow this.
This *partially* fixes
[9026](https://github.com/nushell/nushell/issues/9026). That is, nushell
will no longer set the foreground process group in non-interactive mode.
This commit is contained in:
@ -213,7 +213,7 @@ impl ExternalCommand {
|
||||
// fails to be run as a normal executable:
|
||||
// 1. "shell out" to cmd.exe if the command is a known cmd.exe internal command
|
||||
// 2. Otherwise, use `which-rs` to look for batch files etc. then run those in cmd.exe
|
||||
match fg_process.spawn() {
|
||||
match fg_process.spawn(engine_state.is_interactive) {
|
||||
Err(err) => {
|
||||
// set the default value, maybe we'll override it later
|
||||
child = Err(err);
|
||||
@ -235,7 +235,7 @@ impl ExternalCommand {
|
||||
cmd,
|
||||
engine_state.pipeline_externals_state.clone(),
|
||||
);
|
||||
child = cmd_process.spawn();
|
||||
child = cmd_process.spawn(engine_state.is_interactive);
|
||||
} else {
|
||||
#[cfg(feature = "which-support")]
|
||||
{
|
||||
@ -269,7 +269,8 @@ impl ExternalCommand {
|
||||
cmd,
|
||||
engine_state.pipeline_externals_state.clone(),
|
||||
);
|
||||
child = cmd_process.spawn();
|
||||
child =
|
||||
cmd_process.spawn(engine_state.is_interactive);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,7 +287,7 @@ impl ExternalCommand {
|
||||
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
child = fg_process.spawn()
|
||||
child = fg_process.spawn(engine_state.is_interactive)
|
||||
}
|
||||
|
||||
match child {
|
||||
|
Reference in New Issue
Block a user