Commit Graph

10 Commits

Author SHA1 Message Date
Ian Wijma ef1e2c56c0 Refactor 'Retry' instance creation and modify 'run_command' function
Changed the approach for creating 'Retry' instance in main() to avoid mutation behavior by setting 'max_retries', 'timespan' and 'restart_name' initially. The 'per_minute' and 'per_hour' arguments now directly modify these values. Additionally, the 'run_command' function and related functions were refactored to pass 'Retry' instance by value, not reference and to handle 'retry' history separately for each command execution. These changes were made to improve code readability and maintainability.
2023-12-02 21:52:09 +11:00
Ian Wijma 563938e51a Refactor spawn_process fn to handle spawn error
This commit modifies the spawn_process function to explicitly return a Result type, handling the error of the spawn() method. This change improves the readability of the error handling and makes it more idiomatic in Rust. As a secondary correction, it fixes a typo in a print statement.
2023-11-21 00:31:37 +11:00
Ian Wijma 9392325115 Correct commit message for the given diff:
Add newline character to error message

In this commit, a newline character `\n` was added at the end of the error message in the `print!` function within main.rs. This change ensures the output from the program is properly formatted and readable, increasing the overall user experience when such exceptions are encountered.
2023-11-21 00:08:03 +11:00
Ian Wijma 8581f19127 Remove outdated codebase
This commit deletes the current codebase and configurations because we're switching to rust. This includes src/index.js, package.json, package-lock.json and .gitignore files. A refactor or rewrite app with updated dependencies and code style will be added afterwards.
2023-11-20 23:40:22 +11:00
Ian Wijma 99cc6708c6 Add new scripts to package.json and handle rpm/rph conflict
Keep Running / Build (push) Failing after 2m51s Details
Updated the package.json with two new scripts: copy-local and build-local. This allows for easier local testing by building and copying the program to a local directory. In index.js, handled the situation where both rpm and rph options are provided by the user, which was causing conflicts. This is resolved by adding explicit handling which returns an error and asks the user to choose only one.
2023-11-19 16:19:24 +11:00
Ian Wijma a65ca4e37f "Added .help() method in the command configuration"
In this commit, the .help() method was moved to an earlier part of the command configuration. Previously, .help() was executed after defining options. The reason for this change was to improve code readability and ensure that the help command is processed in line with other commands, improving user experience by offering immediate assistance for all commands. This effective placement of .help() method should make it easier for users to understand how to interact with the command line interface.
2023-11-19 15:40:19 +11:00
Ian Wijma 7a43503c52 "Added delay option and improved error logging in process manager"
This commit introduces a delay option to the process manager. This option allows us to set the time delay before restarting a process that has crashed. This is useful in scenarios where an immediate restart might cause further issues or allow time for external dependencies to become available again.

It also refines the error logging by reducing the amount of crash logs printed. Now, only the last crash log is presented which aides in maintaining readability. A conflict prevention has been also added to reduce the chance of mixed usage between 'rpm' and 'rph' options.

The update also enforces tidiness by adding an extraneous file to the .gitignore list.
2023-11-19 15:38:49 +11:00
Ian Wijma 84f6c26361 Fix the retrying not working. 2023-11-19 14:21:54 +11:00
Ian Wijma 77e1f29417 Added stderr output to the test command & updated console output 2023-11-19 13:36:20 +11:00
Ian Wijma 510d299276 Created Keep Running (kr) command 2023-11-19 13:28:59 +11:00