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

fix: exit code not passed to sys.exit #209

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

jackie-linz
Copy link
Contributor

@jackie-linz jackie-linz commented Aug 26, 2024

fixes: #208

tested locally

$ python3 -m awscurl --service lambda https://<my-function-url>.lambda-url.ap-southeast-2.on.aws/
{"data":"Hello from Lambda!"}
$ echo $?
1

@okigan
Copy link
Owner

okigan commented Aug 26, 2024

hmm, maybe that should follow curl's logic:

https://curl.se/docs/manpage.html#-f

key part: By default, curl does not consider HTTP response codes to indicate failure.

@jackie-linz
Copy link
Contributor Author

That's fair, should I add -f/--fail option then?

@jackie-linz
Copy link
Contributor Author

actually, --fail-with-body may be closer to what awscurl is doing...

@okigan
Copy link
Owner

okigan commented Aug 26, 2024

Sounds good -- please update pr

@jackie-linz
Copy link
Contributor Author

done, tested locally

$ python3 -m awscurl --service lambda https://<my-function>.lambda-url.ap-southeast-2.on.aws/ 
{"data":"Hello from Lambda!"}
$ echo $?
0

$ python3 -m awscurl --fail-with-body --service lambda https://<my-function>.lambda-url.ap-southeast-2.on.aws/ 
{"data":"Hello from Lambda!"}
$ echo $?
22

@okigan okigan merged commit ff4a661 into okigan:master Aug 26, 2024
13 checks passed
@okigan
Copy link
Owner

okigan commented Aug 26, 2024

@jackie-linz new release published

@jackie-linz jackie-linz deleted the fix/exit-code branch August 26, 2024 05:00
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.

Incorrect exit code when the HTTP response is failure
2 participants