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

Automatic termination with return code from a native_posix main function #54575

Closed
ivanwagner opened this issue Feb 7, 2023 · 2 comments
Closed
Labels
area: native port Host native arch port (native_sim) Enhancement Changes/Updates/Additions to existing features

Comments

@ivanwagner
Copy link

Is your enhancement proposal related to a problem? Please describe.
A clear and concise description of what the problem is.

I have a running application compiled for the native_posix target and I need this application to terminate automatically. In fact the what I see is that the Zephyr OS just hangs where after all the output I see on the console.

Is this somehow possible? Even just a "return;" statement within my main doesn't actually return.

I need a return code from this application so that another application can read it and take further actions.

Is this somehow possible? If not, can it be added somehow? I can contribute but don't know how the native_posix target actually works.

Thank you,

ivan

@ivanwagner ivanwagner added the Enhancement Changes/Updates/Additions to existing features label Feb 7, 2023
@henrikbrixandersen henrikbrixandersen added the area: native port Host native arch port (native_sim) label Feb 8, 2023
@ivanwagner
Copy link
Author

I've seen that if -stop_at=0 is provided to the native_posix binary image then the process returns as soon as the user main function terminates.

What about the return code? Is there any control over that?

@ivanwagner
Copy link
Author

I found a solution by using native_get_test_cmd_line_args to parse args given with -testargs and posix_exit to actually give my own return code and exit the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: native port Host native arch port (native_sim) Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

2 participants