Clean up interactive session test

This commit is contained in:
ridiculousfish 2013-10-26 15:24:49 -07:00
parent e05743d0ba
commit 03c65d7a96
2 changed files with 9 additions and 15 deletions

View file

@ -365,18 +365,12 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *out_c
is_login |= (strcmp(argv[0], "-fish") == 0);
/*
We are an interactive session if we have not been given an
explicit command to execute, _and_ stdin is a tty.
*/
is_interactive_session &= ! has_cmd;
is_interactive_session &= (my_optind == argc);
is_interactive_session &= isatty(STDIN_FILENO);
/*
We are also an interactive session if we have are forced-
*/
is_interactive_session |= force_interactive;
/* We are an interactive session if we are either forced, or have not been given an explicit command to execute and stdin is a tty. */
if (force_interactive) {
is_interactive_session = true;
} else if (is_interactive_session) {
is_interactive_session = ! has_cmd && (my_optind == argc) && isatty(STDIN_FILENO);
}
return my_optind;
}

View file

@ -694,7 +694,7 @@ static void daemonize()
}
/*
Put ourself in out own processing group
Put ourself in our own process group
*/
setsid();