termux / termux-api-package

Termux package containing scripts to call functionality in Termux:API.
MIT License
994 stars 314 forks source link

`termux-api` never returns if Android app is not installed #138

Open twaik opened 2 years ago

twaik commented 2 years ago

Problem description termux-api never returns if Android app is not installed. And atermux-api even does not report that maybe there is a problem.

Steps to reproduce Uninstall Termux::API application in Android and try to send it command.

Expected behavior It should report to stderr that there is a problem while trying to contact application and finish with error code.

Additional information

Application version:
0.117
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.librehat.com/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
Updatable packages:
All packages up to date
Android version:
11
Kernel build information:
Linux localhost 4.19.87-20970822 #1 SMP PREEMPT Fri Aug 6 19:16:20 KST 2021 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-G780F

Way to fix You can try poll a socket before trying to accept it. I mean you should start poll with timeout and then react on POLLIN or finish a program with error.