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

when subprocess throws error, try to get system message; make sure error code prints correctly #357

Closed
mitzimorris opened this issue Mar 8, 2021 · 6 comments · Fixed by #447

Comments

@mitzimorris
Copy link
Member

Summary:

When a subprocess fails, the error code is an unsigned int (?) but is printed as a signed int - error codes > 127 become negative, e.g. '-11'. add mode logic to get system error message for the error code and cast return code to prevent manglinag.

Description:

Describe the issue as clearly as possible.

Additional Information:

Provide any additional information here.

Current Version:

@mitzimorris mitzimorris self-assigned this Mar 8, 2021
@mitzimorris mitzimorris changed the title when subprocess throws error, try to get system message ad report error as signed int when subprocess throws error, try to get system message; make sure error code prints correctly Mar 8, 2021
@mitzimorris
Copy link
Member Author

still how to interpret return codes above 127. e.g., running CmdStan via bash shell with segfault terminated by signal -6 is reported as return code 134 - 128 + 6 or ???
in any case, PR #358 will improve error reporting.

@mitzimorris
Copy link
Member Author

maybe this is the answer to some problems: https://stackoverflow.com/a/13789263

@ahartikainen
Copy link
Contributor

np.uint8(np.int8(-6)) == 250 ?

@mitzimorris
Copy link
Member Author

hi @ahartikainen - context?

https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess.returncode
question: on which architectures are posix threads used? or never?

@ahartikainen
Copy link
Contributor

Hah, nevermind. So '-11' -> 11 on posix systems?

@mitzimorris
Copy link
Member Author

so it would seem.

@mitzimorris mitzimorris mentioned this issue Aug 31, 2021
2 tasks
@WardBrian WardBrian linked a pull request Sep 1, 2021 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants