From 55b3c45f95ba09efa4b9eaad8ec49256a7435823 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 9 Sep 2017 22:26:57 -0500 Subject: [PATCH] No longer put fish in own process group on startup As discussed in #3805, this patch disables assigning fish to its own process group at startup. This was trialled in #4349 alongside other pgrp fixes which introduced additional problems, but this particular fix seems to be OK. Fixes #3805 and works around Microsoft/BashOnWindows#1653 --- src/reader.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index 065f30f3e..441aa3f97 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1626,30 +1626,8 @@ static void reader_interactive_init() { signal_set_handlers(); } - // Put ourselves in our own process group. - shell_pgid = getpid(); - if (getpgrp() != shell_pgid && setpgid(shell_pgid, shell_pgid) < 0) { - debug(0, _(L"Couldn't put the shell in its own process group")); - wperror(L"setpgid"); - exit_without_destructors(1); - } - - // Grab control of the terminal. - if (tcsetpgrp(STDIN_FILENO, shell_pgid) == -1) { - if (errno == ENOTTY) redirect_tty_output(); - debug(0, _(L"Couldn't grab control of terminal")); - wperror(L"tcsetpgrp"); - exit_without_destructors(1); - } - invalidate_termsize(); - // Set the new modes. - if (tcsetattr(0, TCSANOW, &shell_modes) == -1) { - if (errno == EIO) redirect_tty_output(); - wperror(L"tcsetattr"); - } - env_set_one(L"_", ENV_GLOBAL, L"fish"); }