Preserve Session Terminal TTY through causal launch
This commit is contained in:
parent
2af8a4f09f
commit
39307f4281
1 changed files with 87 additions and 8 deletions
|
|
@ -88,7 +88,9 @@ fn terminal_child_restores_slave_stdin_and_merges_output() -> std::io::Result<()
|
|||
let slave = File::from(slave);
|
||||
let target = TargetCommand::new("/bin/sh")
|
||||
.argument("-c")
|
||||
.argument("read value; printf 'out:%s\\n' \"$value\"; printf 'err\\n' >&2")
|
||||
.argument(
|
||||
"read value; printf 'stdin-fd\\n' >&0; printf 'out:%s\\n' \"$value\"; printf 'err\\n' >&2",
|
||||
)
|
||||
.with_target_stdin(slave.try_clone()?)?;
|
||||
let expected_parent = current_process_identity()?;
|
||||
let ownership = ProcessOwnershipContext {
|
||||
|
|
@ -117,10 +119,13 @@ fn terminal_child_restores_slave_stdin_and_merges_output() -> std::io::Result<()
|
|||
let _ = read_available(&mut master, &mut merged);
|
||||
let exit = child_broker().reap_status(process)?;
|
||||
let text = String::from_utf8_lossy(&merged);
|
||||
let stdin = text.find("stdin-fd");
|
||||
let out = text.find("out:hello");
|
||||
let err = text.find("err");
|
||||
if !matches!((out, err), (Some(out), Some(err)) if out < err)
|
||||
|| exit.exit_code != Some(0)
|
||||
if !matches!(
|
||||
(stdin, out, err),
|
||||
(Some(stdin), Some(out), Some(err)) if stdin < out && out < err
|
||||
) || exit.exit_code != Some(0)
|
||||
|| exit.terminating_signal.is_some()
|
||||
{
|
||||
return Err(std::io::Error::other(format!(
|
||||
|
|
|
|||
Loading…
Reference in a new issue