Use temp file for cache
This commit is contained in:
parent
0b3c6bfe92
commit
d058087729
6
cbattery
6
cbattery
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CACHE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/cbattery.status"
|
TMP_FILE=/tmp/cbattery.status
|
||||||
SHARE_DIR=/usr/local/share/cbattery
|
SHARE_DIR=/usr/local/share/cbattery
|
||||||
PATH="/usr/bin:/usr/local/bin:/usr/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew:$PATH"
|
PATH="/usr/bin:/usr/local/bin:/usr/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew:$PATH"
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
write_cache() {
|
write_cache() {
|
||||||
echo "$1" > "$CACHE_FILE"
|
echo "$1" > "$TMP_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
read_cache() {
|
read_cache() {
|
||||||
cat "$CACHE_FILE" 2> /dev/null
|
cat "$TMP_FILE" 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_discharging() {
|
enable_discharging() {
|
||||||
|
|
Loading…
Reference in New Issue