mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-28 05:10:40 +00:00
Improve error handling and cleanup in shell functions (#10116)
Refactored various shell functions to add more robust error handling by redirecting stderr to /dev/null and using '|| true' to prevent script failures. Enhanced npm cache cleanup to remove both _cacache and _logs directories, and improved reliability of version and keyring extraction commands. These changes increase script resilience and prevent unnecessary errors from halting execution.
This commit is contained in:
committed by
GitHub
parent
e0e7aa94e8
commit
c1ef6d7c51
+3
-5
@@ -815,12 +815,10 @@ cleanup_lxc() {
|
||||
xargs -0 -n1 truncate -s 0 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Node.js npm
|
||||
# Node.js npm - directly remove cache directory
|
||||
# npm cache clean/verify can fail with ENOTEMPTY errors, so we skip them
|
||||
if command -v npm &>/dev/null; then
|
||||
npm cache verify &>/dev/null || true
|
||||
# Directly remove cache directory instead of using npm cache clean
|
||||
# which can fail with ENOTEMPTY errors
|
||||
rm -rf /root/.npm/_cacache 2>/dev/null || true
|
||||
rm -rf /root/.npm/_cacache /root/.npm/_logs 2>/dev/null || true
|
||||
fi
|
||||
# Node.js yarn
|
||||
if command -v yarn &>/dev/null; then $STD yarn cache clean || true; fi
|
||||
|
||||
Reference in New Issue
Block a user