Skip to content

Improve exit codes #2021

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

Closed
3 tasks done
dankeboy36 opened this issue Jan 3, 2023 · 3 comments
Closed
3 tasks done

Improve exit codes #2021

dankeboy36 opened this issue Jan 3, 2023 · 3 comments
Assignees
Labels
type: enhancement Proposed improvement

Comments

@dankeboy36
Copy link
Contributor

Describe the request

Please provide a broader range of exit codes. It's very often 1, making it hard to handle errors programmatically.

These are different kinds of programmer and user errors, but it takes time to figure them out because the exit code is the same:

  • Sketch is missing.
  • There are compiler errors.
  • The required platform is not installed.
  • Incorrect FQBN was given.
  • No FQBN was given.

Describe the current behavior

XXX@ arduino-cli % cat ./test_sketch/ok/ok.ino                                  
void setup() {}
void loop() {}
XXX@ arduino-cli % cat ./test_sketch/broken/broken.ino                          
trash
XXX@ arduino-cli % ./arduino-cli version                                        
arduino-cli  Version: git-snapshot Commit: 357d4653 Date: 2023-01-03T09:30:23Z
XXX@ arduino-cli % ./arduino-cli compile -b arduino:avr:uno ./test_sketch/broken           
/Users/XXX/dev/arduino-cli/test_sketch/broken/broken.ino:1:1: error: 'trash' does not name a type; did you mean 'tanh'?
 trash
 ^~~~~
 tanh



Used platform Version Path                                                                   
arduino:avr   1.8.5   /Users/XXX/Library/Arduino15/packages/arduino/hardware/avr/1.8.5

Error during build: exit status 1
XXX@ arduino-cli % echo $?                                                                 
1
XXX@ ./arduino-cli compile -b arduino:avr:uno ./test_sketch/missing          
Error opening sketch: no such file or directory: /Users/XXX/dev/arduino-cli/test_sketch/missing
XXX@ arduino-cli % echo $?                                                     
1
XXX@ arduino-cli % ./arduino-cli compile -b arduino:mbed:nanorp2040connect ./test_sketch/ok


Used platform Version Path
                          

Error during build: Platform 'arduino:mbed' not found: platform not installed
Try running `arduino-cli core install arduino:mbed`
XXX@ arduino-cli % echo $?                                                                 
1
XXX@ arduino-cli % ./arduino-cli compile -b trash:fqbn ./test_sketch/ok                    


Used platform Version Path
                          

Error during build: Invalid FQBN: not an FQBN: trash:fqbn
XXX@ arduino-cli % echo $?                                                                 
1
XXX@ arduino-cli % ./arduino-cli compile ./test_sketch/ok 
Missing FQBN (Fully Qualified Board Name)
XXX@ arduino-cli % echo $?                               
1
XXX@ arduino-cli % 

Arduino CLI version

arduino-cli Version: git-snapshot Commit: 357d465 Date: 2023-01-03T09:30:23Z

Operating system

macOS

Operating system version

11.6.5

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details
@dankeboy36 dankeboy36 added the type: enhancement Proposed improvement label Jan 3, 2023
@scottchiefbaker
Copy link

This gets a +1 from me.

@cmaglie cmaglie added this to the Arduino CLI 1.0 milestone Jun 9, 2023
@alessio-perugini alessio-perugini linked a pull request Jun 20, 2023 that will close this issue
6 tasks
@alessio-perugini
Copy link
Contributor

Closed.
Reason: #2221 (comment)

@kittaakos
Copy link
Contributor

Closing as not planned.

@kittaakos kittaakos closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants