Enable macOS foreground process handling (#9909)

# Description
Currently, foreground process management is disabled for macOS, since
the original code had issues (see #7068).
This PR re-enables process management on macOS in combination with the
changes from #9693.

# User-Facing Changes
Fixes hang on exit for nested nushells on macOS (issue #9859). Nushell
should now manage processes in the same way on macOS and other unix
systems.
This commit is contained in:
Ian Manske
2023-08-04 20:43:35 +00:00
committed by GitHub
parent 71b74a284a
commit f615038938
4 changed files with 71 additions and 50 deletions

View File

@ -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 {