moonbitlang / moon

The build system and package manager for MoonBit
https://moonbitlang.github.io/moon/
GNU Affero General Public License v3.0
187 stars 17 forks source link

internal: enable args passing for js & native backend in run mode #469

Closed Young-Flash closed 1 week ago

peter-jerry-ye-code-review[bot] commented 1 week ago

Suggestions based on the git diff output:

  1. Removal of bail in run_js and run_native functions:

    • The bail macro from anyhow is used to immediately exit the function with an error message. Removing it means that the function will no longer handle the case where args is not empty. This could potentially lead to unexpected behavior if extra arguments are provided, as the function will proceed without any error message.
    • Suggestion: Consider adding validation for args and providing a meaningful error message if it is not empty.
  2. Removal of .arg("--") in run function:

    • The -- argument is used to signify the end of command options, effectively separating the command itself from its arguments. Removing this could cause issues if any of the arguments are interpreted as options by the command being executed.
    • Suggestion: Ensure that the command being executed does not misinterpret any of the provided arguments. If necessary, consider reintroducing the -- argument.
  3. General Code Simplification:

    • The changes simplify the code by removing unnecessary checks and arguments, which could improve performance and readability. However, it's crucial to ensure that these changes do not introduce new bugs or undermine the intended functionality.
    • Suggestion: Thoroughly test the modified functions to ensure they behave as expected, especially in edge cases where extra arguments might be provided.

These suggestions aim to maintain the correctness and robustness of the code while addressing the changes introduced in the git diff.