ArduPilot / ArduPilot/MAVProxy

mavproxy always exits with code 1 in non-interactive/daemon mode

Open
#1,192 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
595
Forks
773
Avg merge
2d 6h
Merged PRs (30d)
18

Description

It looks to me like there is no way to make MAVProxy exit cleanly in non-interactive/daemon mode.

There are only three places I can find a `sys.exit(0)` in mavproxy.py:

1. If there is a [null input passed to `process_stdin()`](https://github.com/ArduPilot/MAVProxy/blob/0384b76524f6e6ced504dadab32f37396890bb86/MAVProxy/mavproxy.py#L713) (presumably this occurs when the user presses Ctrl-D), not applicable in non-interactive/daemon mode
2. If you [pass `--version`](https://github.com/ArduPilot/MAVProxy/blob/0384b76524f6e6ced504dadab32f37396890bb86/MAVProxy/mavproxy.py#L1320)
3. If the [signal handler gets called while mavproxy is already attempting to exit](https://github.com/ArduPilot/MAVProxy/blob/0384b76524f6e6ced504dadab32f37396890bb86/MAVProxy/mavproxy.py#L1362), I don't see how to trigger this

At the end of the main function, it always calls `sys.exit(1)`. Am I missing something?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in MAVProxy/mavproxy.py, especially process_stdin() around line 713, the --version path near line 1320, the signal handler near line 1362, and the end of main where sys.exit(1) is called. Trace the non-interactive or daemon-mode shutdown path and compare it with the existing clean exits. Done means that normal daemon shutdown returns the expected success exit code.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.