Subject: bug#13299: 24.3.50; Tramp adb and device not found

From: Michael Albinus <[email-masked]>
Date: Mon, 18 Mar 2013 18:36:37 +0100

Eli Zaretskii <[email-masked]> writes:

>> There is the following code:
>> 
>>   (with-timeout (10)
>>     (with-temp-buffer
>>       (when (zerop (call-process tramp-adb-program nil t nil "devices"))
>>       ...
>> 
>> No problem under GNU/Linux. Under MS Windows, the timeout does not
>> interrupt the `call-process' form, when it is overdued. That's why I
>> have replaced it with a `start-process' implementation.
>
> Hmm... can you describe how this works on Posix platforms?  Once
> call-process forks the child process, it is AFAICS blocked inside
> waitpid, so how do Emacs timers (which are the basis for with-timeout)
> succeed to run at all?  What am I missing?

I haven't digged too much. Likely, it works under GNU/Linux because any
"adb devices" call returns in time, successful or not.

On MS Windows, the very first call of "adb devices" does not return in
the case no Android device is connected. Once adb runs on MS Windows,
any further call of "adb devices" returns in time.

So there is no difference in the timeout behaviour of Emacs. But since I
don't test on MS WIndows usually, it took that time to understand/fix
the problem for me.

Best regards, Michael.