mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 11:23:59 +08:00
Fix the flaky tty_ownership test on Mac
The tty_ownership test was sometimes failing. In this test, `fish_test_helper` creates a child and transfers the tty to it, "abandoning" the tty. In some cases, the child was running before the parent; the child claims the tty. When the parent tries to transfer it to the child, it get SIGTTIN and stops. Fix this by ignoring SIGTTIN and SIGTTOU. This only affects macOS and BSDs.
This commit is contained in:
parent
b6ca8dca27
commit
7ee161af8d
|
@ -13,6 +13,10 @@
|
|||
#include <iterator> // for std::begin/end
|
||||
|
||||
static void abandon_tty() {
|
||||
// The parent may get SIGSTOPed when it tries to call tcsetpgrp if the child has already done
|
||||
// it. Prevent this by ignoring signals.
|
||||
signal(SIGTTIN, SIG_IGN);
|
||||
signal(SIGTTOU, SIG_IGN);
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) {
|
||||
perror("fork");
|
||||
|
|
Loading…
Reference in New Issue
Block a user