Is there any way to exit with an arbitrary value from a simple python script? Actually, I’d like to return with a port number. I’ve read around here and in the docs as well, but found only workarounds…
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The unix
exitcode is a byte. Values larger than >127 are reserved. No, you cannot reliably pass a port number via this hack. Why don’t you just print it to stdout and parse that output?https://www.gnu.org/software/libc/manual/html_node/Exit-Status.html