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

core list machine readable output is null when no platforms are installed #2690

Closed
3 tasks done
per1234 opened this issue Aug 13, 2024 · 0 comments · Fixed by #2691
Closed
3 tasks done

core list machine readable output is null when no platforms are installed #2690

per1234 opened this issue Aug 13, 2024 · 0 comments · Fixed by #2691
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Aug 13, 2024

Describe the problem

arduino-cli core list --format json outputs a machine readable list of the installed boards platforms.

If no platforms are installed, the logical behavior is to output an empty array ([]).

🐛 The behavior recently changed to outputting the inappropriate null instead of an empty array. This will break any code that parses this output which was designed for the previous behavior, when run in an environment where no platforms are installed.

To reproduce

Set Up

$ export ARDUINO_DIRECTORIES_DATA="/tmp/empty/arduino-cli-directories/data" # Set up an environment where no platforms are installed.

$ export ARDUINO_DIRECTORIES_USER="/tmp/empty/arduino-cli-directories/user"

Demo

$ git checkout ad5dacca220162cd5dd736ef89d341f9b82137a0^1  # Checkout the last commit before the regression.

HEAD is now at eb8f2f246 [skip-changelog] testsuite: added mocked serial monitor for integration tests (#2379)

$ task build

[...]

$ ./arduino-cli version

arduino-cli.exe  Version: git-snapshot Commit: eb8f2f246 Date: 2024-08-13T04:23:41Z

$ ./arduino-cli --format json core list

[]

🙂 The output is an empty array.

$ git checkout master

[...]

$ task build

[...]

$ ./arduino-cli version

arduino-cli  Version: 1.0.4 Commit: a0d912da1 Date: 2024-08-13T04:26:35Z

$ ./arduino-cli --format json core list

{
  "platforms": null
}

🐛 The output is the inappropriate null.


Note that the breaking change in the overall data format between the two Arduino CLI versions used in the demos, where the list of installed platforms is now provided under the platforms key of an object is intended, documented, reasonable, and not the subject of this issue report.


Expected behavior

The list of platforms is always an array:

{
  "platforms": []
}

Arduino CLI version

1.0.4

Operating system

  • Windows

Operating system version

  • Windows 11

Additional context

The regression occurred at ad5dacc (#2357).


Originally reported at arduino/compile-sketches#310

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary detailst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant