open-eid / chrome-token-signing

DEPRECATED Chrome and Firefox extension for signing with your eID on the web
https://github.com/open-eid/chrome-token-signing/wiki
GNU Lesser General Public License v2.1
206 stars 75 forks source link

Exit with failure when stdin is an empty file #146

Closed metala closed 5 years ago

metala commented 5 years ago

Signed-off-by: Marin Ivanov dev@metala.org

metala commented 5 years ago

The reason When you run chrome-token-signing < /dev/null, the process goes haywire and takes a whole CPU thread that is doing nothing, but polling stdin. This happens when you try to run chromium-browser in your desktop environment, but command completion suggests chrome-signing-token amd you run it, instead.

strace

poll([{fd=0, events=POLLIN}, {fd=5, events=POLLIN}], 2, -1) = 1 ([{fd=0, revents=POLLIN}])
fcntl(0, F_GETFL)                       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fcntl(0, F_SETFL, O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 0
read(0, "", 16384)                      = 0
... <repeats forever> ...