Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Add exit-service #6

Merged
merged 3 commits into from
Jun 16, 2021
Merged

Add exit-service #6

merged 3 commits into from
Jun 16, 2021

Conversation

siegfriedweber
Copy link
Member

@siegfriedweber siegfriedweber commented Jun 16, 2021

  • exit-service added
$ cat exit-service-1.0.0/start.sh
#!/bin/sh

exit $EXIT_CODE
  • Services sorted alphabetically in the READMEs.
  • Long lines reformatted.

The exit-service is used to test stackabletech/agent#117.

@siegfriedweber siegfriedweber requested a review from a team June 16, 2021 12:47
@siegfriedweber siegfriedweber self-assigned this Jun 16, 2021
@soenkeliebau
Copy link
Member

LGTM overall, just one question..

It seems to me that the implementation of returning 0 when EXIT_CODE is not set relies on the behavior of exit when it receives no parameter?
I googled briefly and found this sentence:

If N is omitted, the exit status is that of the last command executed.

I'm probably way of the reservation here and you considered this, so by all means feel free to merge as is, just a thought that occurred to me!

soenkeliebau
soenkeliebau previously approved these changes Jun 16, 2021
@siegfriedweber
Copy link
Member Author

It seems to me that the implementation of returning 0 when EXIT_CODE is not set relies on the behavior of exit when it receives no parameter?
I googled briefly and found this sentence:

If N is omitted, the exit status is that of the last command executed.

The initial error status is 0. If there is no "last command" then this initial error status is returned. This is concise but I must admit that extending the code is hard because the command before exit must never return anything than 0. So I changed the code:

#!/bin/sh

exit ${EXIT_CODE:-0}

Copy link
Member

@soenkeliebau soenkeliebau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@siegfriedweber siegfriedweber merged commit ef8b729 into main Jun 16, 2021
@siegfriedweber siegfriedweber deleted the exit_service branch June 16, 2021 14:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants