SonarQube
  1. SonarQube
  2. SONAR-2969

Improve CommandExecutor to execute and test the exit code

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.12
    • Fix Version/s: None
    • Component/s: API
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Currently, CommandExecutor.execute() returns the exit code of the executed command.

      However, there are many cases in which we expect an internal tool to exit with a given (and possibly set of) exit codes.

      CommandExecutor should provide a way, out of the box, to both execute and test the exit code, instead of leaving that logic to its callers.

      One option is to add a method such as:

      executeAndExpect(command, int acceptableCodes...)
      

      Anoter option is to use a property of a Command, but this might prevent the use case of several executions of the same Command expecting different exit codes across multiple executions.

      In order to make it possible to more easily reuse the CommandException class, it should provide a constructor which does not take an inner exception as argument. The current workaround is to pass null as the inner exception argument.

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Dinesh Bolkensteyn
            • Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: