forked from github/abduco
Do not implicilty enable passthrough mode if no session name is given
Even when no session name was provided the passthrough flag was still implicitly enabled in case stdin was not a terminal. This behavior prevented the session list from being printed i.e. abduco < /dev/null would not work as expected. Only enable implicit passthrough if stdin is not a terminal *and* a session name is given. Fix #34
This commit is contained in:
parent
c33ee37b43
commit
8f80aa8044
19
abduco.c
19
abduco.c
|
|
@ -606,8 +606,6 @@ int main(int argc, char *argv[]) {
|
|||
server.name = basename(argv[0]);
|
||||
gethostname(server.host+1, sizeof(server.host) - 1);
|
||||
|
||||
passthrough = !isatty(STDIN_FILENO);
|
||||
|
||||
while ((opt = getopt(argc, argv, "aAclne:fpqrv")) != -1) {
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
|
|
@ -646,13 +644,6 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
if (passthrough) {
|
||||
if (!action)
|
||||
action = 'a';
|
||||
quiet = true;
|
||||
client.flags |= CLIENT_LOWPRIORITY;
|
||||
}
|
||||
|
||||
/* collect the session name if trailing args */
|
||||
if (optind < argc)
|
||||
server.session_name = argv[optind];
|
||||
|
|
@ -663,6 +654,16 @@ int main(int argc, char *argv[]) {
|
|||
else
|
||||
cmd = default_cmd;
|
||||
|
||||
if (server.session_name && !isatty(STDIN_FILENO))
|
||||
passthrough = true;
|
||||
|
||||
if (passthrough) {
|
||||
if (!action)
|
||||
action = 'a';
|
||||
quiet = true;
|
||||
client.flags |= CLIENT_LOWPRIORITY;
|
||||
}
|
||||
|
||||
if (!action && !server.session_name)
|
||||
exit(list_session());
|
||||
if (!action || !server.session_name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue