Wrong exit status is returned when uploading using the command line interface
- Dominant language
- Java
- Stars
- 14.6k
- Forks
- 7k
- PR merge metrics
- No merged PRs in 30d
Description
When upload fails using the CLI it often returns with exit status 0 instead of an error code. I am using version 1.6.6 on Linux.
For example, if I try to upload to a device that doesn't exist:
```
arduino --board arduino:avr:uno --port /dev/NO_SUCH_DEVICE --upload ~/Arduino/blink/blink.ino
```
The exit status is 0 even though the console output will show that the upload fails:
```
Picked up JAVA_TOOL_OPTIONS:
Loading configuration...
Initializing packages...
Preparing boards...
Verifying and uploading...
Sketch uses 1,030 bytes (3%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can't open device "/dev/BAD_DEVICE": No such file or directory
ioctl("TIOCMGET"): Inappropriate ioctl for device
```
If I run the command multiple times it will sometimes return with exit code 1 and add the following line of output:
```
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
```
Contributor guide
Research direction
Start by reproducing the provided CLI upload command with a nonexistent device and compare the process exit status when the upload failure is reported. Trace the command-line upload flow and its handling of the upload result; done means every failed upload consistently exits with a nonzero status while successful uploads retain a zero status.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100