Fix strange behavior with abduco -A

Here are the steps:

1) Run 'abduco -A foo ping suckless.org'

2) Press 'CTRL+\' to detach

3) Run 'abduco -A foo' to reattach

4) Press 'CTRL+\' and it flashes the screen but does not detach

5) Press 'CTRL+\' a second time and it detaches this time

Here's what the output looks like:

    $ abduco -A foo ping suckless.org
    abduco: foo: detached
    $ abduco -A foo
    abduco: foo: detached
    abduco: foo: detached
    $

Also, oddly, I am only seeing this behavior on my Ubuntu Linux host, not
my AIX hosts.
This commit is contained in:
Ross Mohn 2015-06-23 13:04:16 +02:00 committed by Marc André Tanner
parent 33a637bd2a
commit 91feaaa9f9
1 changed files with 4 additions and 3 deletions

View File

@ -633,9 +633,10 @@ int main(int argc, char *argv[]) {
die("attach-session");
break;
case 'A':
if (session_alive(server.session_name) && !attach_session(server.session_name, true))
die("attach-session");
if (!attach_session(server.session_name, !force)) {
if (session_alive(server.session_name)) {
if (!attach_session(server.session_name, true))
die("attach-session");
} else if (!attach_session(server.session_name, !force)) {
force = false;
action = 'c';
goto redo;