On Tue, Jun 02, 2015 at 12:26:38PM -0400, Ross Mohn wrote:
> Hi,
>
> After my last pull a few weeks ago, I started noticing some strange
> behavior with abduco and I want to know if others can reproduce it.
> 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
> $
I found where this issue was introduced and I propose the attached patch
to fix it.
Thanks -Ross
diff --git a/abduco.c b/abduco.c
index 5c4d174..9836149 100644
--- a/abduco.c
+++ b/abduco.c
@@ -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;