godspeed1989 / fbv

framebuffer image viewer
Other
81 stars 39 forks source link

Slideshow does not work if exectuted from within shell script #20

Closed avanc closed 3 years ago

avanc commented 3 years ago

Running fbv -s 100 image.jpg > /dev/null & works with the latest commit (1f607276d38998d065366c0d26a8299d14175794) as expected: The image is shown and after 10 seconds the fbv process has ended.

However, putting the same into a shell script does not work:

#! /bin/sh
fbv -s 100 image.jpg > /dev/null &

By executing this script, the image is correctly shown. However, the background process fbv never ends. It seems that the special delay approach https://github.com/godspeed1989/fbv/blob/1f607276d38998d065366c0d26a8299d14175794/main.c#L387 does not work and fbv wait for a user input forever. It seems that the approach uses somehow the timeout of file descriptors. But I have to admit that I don't understand it fully. Any advice would help.

avanc commented 3 years ago

The problem is that the "select" returns immediately and get_char returns EOF (-1) if in non interactive terminal.