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

Add return code 3 #36

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add return code 3 #36

wants to merge 4 commits into from

Conversation

pchg
Copy link

@pchg pchg commented Sep 12, 2023

This pull request replaces the previous one "Add return code 2":
#31
When calling this script from a shell script, I bumped into some download errors, and some partially files were left as *tmp ; I wanted a way to check that the theia_download.py got executed fine, by using an exit code.

I added a return_code variable and a return_code_final variable, which I both first initialised to 0 quite early (to avoid some errors in case the curl line wasn't executed). Every time the curl call is made, its return code is assigned to return_code variable, and return_code_final is aggregated with return_code.
If everything goes well, curl returns 0 and both variables' values stay at 0.

This concatenation makes the final return code quite undecipherable, but it is just supposed to raise something with a non-zero code for a calling script.

Finally, if that final return code is not zero (something went wrong), the program exits with that exit code. This way, a calling script can know that something went wrong.

Additionally, I also added a sys.exit(-1) at the very end, although the -1 may not be the best code to return. To be discussed; I just took example from the other sys.exit() calls in the program.

I also added a print message in case the unzipped product already exists in the current directory.

@olivierhagolle
Copy link
Owner

Thanks ! Unfortunately, I have no time to test it, and I can't accept merge requests like that. I am trying to find someone else at CNES to maintain this software...

@pchg
Copy link
Author

pchg commented Sep 13, 2023

All right, nothing urgent.
I think that I will try the method of Mr @sgascoin in his pull request.
Here it is:

alors ma pull request ?

(citation avec tous les droits d'auteur et toutes ces sortes de choses)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants