mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 16:24:15 +08:00
Ignore EPERM for setpgid
In case we are a session leader, we get a harmless EPERM, yet we used to quit. Stop doing that. Fixes #6499.
This commit is contained in:
parent
759d5a1fb3
commit
31e6ae0099
|
@ -1774,9 +1774,14 @@ static void reader_interactive_init(parser_t &parser) {
|
|||
if (shell_pgid == 0 || session_interactivity() == session_interactivity_t::explicit_) {
|
||||
shell_pgid = getpid();
|
||||
if (setpgid(shell_pgid, shell_pgid) < 0) {
|
||||
FLOG(error, _(L"Failed to assign shell to its own process group"));
|
||||
wperror(L"setpgid");
|
||||
exit_without_destructors(1);
|
||||
// If we're session leader setpgid returns EPERM. The other cases where we'd get EPERM don't apply as we passed our own pid.
|
||||
//
|
||||
// This should be harmless, so we ignore it.
|
||||
if (errno != EPERM) {
|
||||
FLOG(error, _(L"Failed to assign shell to its own process group"));
|
||||
wperror(L"setpgid");
|
||||
exit_without_destructors(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Take control of the terminal
|
||||
|
|
Loading…
Reference in New Issue
Block a user