Add timeout for firefox screenshot function. - annna - Annna the nice friendly bot.
 (HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
       ---
 (DIR) commit ba85134a7b1b94ad20d5bf96a52312ddf84f2d07
 (DIR) parent 9f944d8a25ae5765c9c6b18b48d4ab68140ae623
 (HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Wed, 25 Aug 2021 22:41:02 +0200
       
       Add timeout for firefox screenshot function.
       
       Diffstat:
         M screenshot-paste                    |       2 ++
         M screenshot-uri                      |       4 +++-
       
       2 files changed, 5 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/screenshot-paste b/screenshot-paste
       @@ -9,6 +9,8 @@ then
        fi
        
        pastepath="$(screenshot-uri "$1")"
       +[ -z "${pastepath}" ] && exit 1
       +
        pastefile="$(basename "${pastepath}")"
        
        printf "gopher://bitreich.org/I/p/%s\n" "${pastefile}"
 (DIR) diff --git a/screenshot-uri b/screenshot-uri
       @@ -19,8 +19,10 @@ pastebase="/br/gopher/paste"
        
        cd "${pastebase}"
        tmpfile="$(mktemp p-XXXXXXXXXXXXX.png)"
       -firefox $firefoxargs --new-instance --screenshot \
       +timeout -k 60s 60s firefox $firefoxargs --new-instance --screenshot \
                "${pastebase}/${tmpfile}" "${uri}" 2>&1 >/dev/null
       +# timeout(1) timed out
       +[ $? -eq 124 -o $? -eq 137 ] && exit 1
        
        # Firefox stores with rw----
        chmod g+wr "${pastebase}/${tmpfile}"