Skip to content
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

Refactor Command.run() #2467

Merged
merged 13 commits into from
Feb 19, 2024
Merged

Refactor Command.run() #2467

merged 13 commits into from
Feb 19, 2024

Commits on Feb 19, 2024

  1. Configuration menu
    Copy the full SHA
    33e1bfd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f6fe146 View commit details
    Browse the repository at this point in the history
  3. Refactor Command.run() to return None if cmd not found

    Command.run() currently has a bit of a confusing behavior: if raise_on_error is
    False and the executable is not found, then a weird CommandT is returned (return
    code is -1 and stdout+stderr is None). This makes it possible to hanlde command
    not found errors separately, but it makes that needlessly verbose. So instead,
    let's just return None in *this* special case.
    
    That in turn uncovered, that in most cases when we set `raise_on_error=True`, we
    actually want an error if the command is not present but no error if the command
    fails to execute (e.g. because it returns -1 if you run `$cmd --version`
    🙄). Hence we introduce the flag `raise_on_command_not_found`, which causes an
    exception to be raised if the command is not found. This makes it independent of
    the `raise_on_error` flag.
    
    Additionally, we add a small optimization: if command starts with /, then we
    assume it's a full path and we omit the call to which (and just check whether it
    exists).
    
    These changes require additional tests and a few assertions in places where mypy
    cannot infer that a certain value is of the correct type.
    dcermak committed Feb 19, 2024
    Configuration menu
    Copy the full SHA
    6e5ebe3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ced604a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    74f2c84 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b4174c8 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e5ce72b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e31308b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    0cb6a3d View commit details
    Browse the repository at this point in the history
  10. py3.7 is out of scope for the tests

    Due to changes in commit fb69627
    schaefi committed Feb 19, 2024
    Configuration menu
    Copy the full SHA
    4dcc0db View commit details
    Browse the repository at this point in the history
  11. Allow empty cherry-picks for compliance test

    If we cherry-pick from main to master the compliance check
    will notice that a commit already exists. This is not an error
    and we can allow to continue the picking via --allow-empty
    schaefi committed Feb 19, 2024
    Configuration menu
    Copy the full SHA
    ea568f9 View commit details
    Browse the repository at this point in the history
  12. Revert "py3.7 is out of scope for the tests"

    This reverts commit 4dcc0db.
    schaefi committed Feb 19, 2024
    Configuration menu
    Copy the full SHA
    5753b9f View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    899b1d3 View commit details
    Browse the repository at this point in the history