Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
Labels
conclusion: resolvedIssue was resolved topic: codeRelated to content of the project itself type: imperfectionPerceived defect in any part of project
@per1234

Description

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月13日T04: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月13日T04:26:35Z
$ ./arduino-cli --format json core list
{
 "platforms": null
}

🐛 The output is the inappropriate null.


i 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    conclusion: resolvedIssue was resolved topic: codeRelated to content of the project itself type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /