🥅 catch file disappearing right before reading

This commit is contained in:
DrMaxNix 2024-09-02 21:53:44 +02:00
parent c794049d19
commit bd099af12f

View File

@ -53,7 +53,8 @@ proc_running(){
# try reading state
local state_path="/proc/$1/stat"
[[ ! -f "$state_path" ]] && return 1
local state=$(cat "$state_path" | cut -d ' ' -f3)
local state
state=$(cat "$state_path" 2> /dev/null | cut -d ' ' -f3) || return 1
# parse state
case "$state" in