-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix termux-notification and termux-toast from hanging when running fr…
…om background In termux-notification, if content is not passed as an argument and then using `[ -t 0 ]` to detect if stdin is also not available does not work for background commands since that is only meant to check if stdin is open and is associated with a terminal. When running in background, the check will fail, since stdin will not be attached to a terminal, but moreover, no data will be available on stdin either and termux-api will hang forever waiting for input. In termux-toast, similar thing happens where if toast text argument is not passed, it is assumed that data will be available on stdin, which it may not be, making termux-api hang forever waiting for input. Now for both, if arguments are not passed, then stdin is attempted to be read directly with a 3s timeout without relying on termux-api. If no data is available on stdin, then an empty string will be passed, after aborting after 3s. Fixes termux/termux-app#1925 Thanks to @krystean for investigating the issue.
- Loading branch information
1 parent
e5860f4
commit ff09377
Showing
2 changed files
with
116 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters