forked from XK4MiLX/watchdog
-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor/use run command #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
XK4MiLX
wants to merge
15
commits into
master
Choose a base branch
from
refactor/use-run-command
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Replace shelljs with child_process.execFile for better security - Add runCommand() for system commands with parameter arrays - Add runShellCommand() for shell commands with pipes/redirects - Fix $USER path variable to use os.homedir() - Convert config initialization to async function pattern - Add graceful error handling - watchdog never crashes - Use modern let/const instead of var - Add proper main() entry point with error recovery - Remove shelljs dependency from package.json All 79 shell.exec calls replaced with appropriate runCommand variants.
Complete refactoring of watchdog.js to use native Node.js child_process: - Implemented runCommand() and runShellCommand() functions with proper error handling - Replaced all 79+ shell.exec() calls with runCommand/runShellCommand - Removed shelljs dependency from package.json Bug fixes: - Fixed function ordering: moved compareVersions and checkCloudUI before job_creator to prevent reference errors - Fixed missing stdout destructuring in checkCloudUI and error_line - Fixed config object literal syntax (semicolons to commas) - Added missing semicolons on lines 1011, 1012, 1427 - Replaced echo $HOME with os.homedir() for path resolution Modernization: - Replaced all var declarations with let/const at appropriate scope levels - Added module-level variables for flux_check variables used across try/catch blocks - Used const for notification variables (emoji_title, info_type, etc.) - Used let for function-scoped variables - Increased checkCloudUI timeout from 30s to 120s for CloudUI download Error handling improvements: - Graceful config initialization - watchdog continues on config errors - Graceful Arcane checks - watchdog continues if checks fail - Never crashes - all errors are caught and logged
Complete refactoring of watchdog.js to use native Node.js child_process: - Implemented runCommand() and runShellCommand() functions with proper error handling - Replaced all 79+ shell.exec() calls with runCommand/runShellCommand - Removed shelljs dependency from package.json Bug fixes: - Fixed function ordering: moved compareVersions and checkCloudUI before job_creator to prevent reference errors - Fixed missing stdout destructuring in checkCloudUI and error_line - Fixed config object literal syntax (semicolons to commas) - Added missing semicolons on lines 1011, 1012, 1427 - Replaced echo $HOME with os.homedir() for path resolution Modernization: - Replaced all var declarations with let/const at appropriate scope levels - Added module-level variables for flux_check variables used across try/catch blocks - Used const for notification variables (emoji_title, info_type, etc.) - Used let for function-scoped variables - Increased checkCloudUI timeout from 30s to 120s for CloudUI download Error handling improvements: - Graceful config initialization - watchdog continues on config errors - Graceful Arcane checks - watchdog continues if checks fail - Never crashes - all errors are caught and logged
- Change console message from "Component update detected!" to "System stabilization period after component update!" to accurately reflect timing (message appears after update completion, not during) - Fix fluxbench log path to use os.homedir() instead of hardcoded '/home/$USER/.fluxbenchmark/debug.log' - Minor whitespace cleanup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
child_process.execFilevarwithlet/construnCommand()andrunShellCommand()helper functions for consistent command executionecho $HOMEshell commands with nativeos.homedir()fs.writeFilecallback issue by usingfs.writeFileSyncBenefits
let/constimproves code clarity and prevents hoisting issues