You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The timeout handler in connection.wait_for_notification() (and other gatttool functions) does something like:
with Popen(cmd, shell=True, ...) as process:
try:
...
except TimeoutExpired:
os.killpg(process.pid, signal.SIGINT)
Because its using shell=True it sends the SIGINT to the /bin/sh process instead of gatttool, which ignores it. The SIGINT needs to be sent directly to the gatttool process. Since the processes are not cleaned up, they build up over time. Often one of them might still have a lock on something, so all subsequent instances of gatttool fail.
This can be easily fixed by removing the shell=True and passing the arguments as a list. e.g.
cmd = ['gatttool', '--device', self._mac, ...]
with Popen(cmd, shell=True, ...) as process:
...
Then process.pid will be that of the gatttool process.
The text was updated successfully, but these errors were encountered:
The timeout handler in
connection.wait_for_notification()
(and other gatttool functions) does something like:Because its using
shell=True
it sends the SIGINT to the/bin/sh
process instead ofgatttool
, which ignores it. The SIGINT needs to be sent directly to thegatttool
process. Since the processes are not cleaned up, they build up over time. Often one of them might still have a lock on something, so all subsequent instances ofgatttool
fail.This can be easily fixed by removing the
shell=True
and passing the arguments as a list. e.g.Then
process.pid
will be that of thegatttool
process.The text was updated successfully, but these errors were encountered: