Skip to content

Fail due to set -e when exec_in #71

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

Closed
ArthurGarnier opened this issue Feb 16, 2016 · 8 comments
Closed

Fail due to set -e when exec_in #71

ArthurGarnier opened this issue Feb 16, 2016 · 8 comments
Labels

Comments

@ArthurGarnier
Copy link
Collaborator

Step to reproduce :

exec_in: |
true
true
false
true

The last true isn't executed due to "set -e" added by kameleon to the script.

@lnussbaum
Copy link

isn't that a good thing? writing scripts without set -e is very dangerous (think of "cd non-existing-dir ; rm *")

if something should be allowed to fail, why not use:
command-that-can-fail || true
?

@jgaida
Copy link

jgaida commented Feb 16, 2016

set -e is full of pitfalls:

IMO, it should be the responsibility of the user to add set -e in its script if he want to. Kameleon users should have the choice to use it or not (and set -e is not a default behaviour).

@mickours
Copy link
Contributor

I also think that set -e is a better default behavior for instructions that are put directly un Kameleon. Also, you can use set +e to override it in your scripts if you want.

@mickours
Copy link
Contributor

I mean we use to have this behavior before and we changes because the silently failing instructions are really hard to catch, and the breakpoint that is triggered by it are really useful.

@ArthurGarnier
Copy link
Collaborator Author

@lnussbaum Some few commands return non-zero value even if all is OK. For example, puppet do that, if some files have changed during the puppet apply, the return code is 2.

Like @jgaida, I think it's the responsability of the user to put -e. But if it's really the behaviour expected, this should be documented here : http://kameleon.imag.fr/commands.html?highlight=exec

@SalemHarrache
Copy link
Contributor

Upon verification, I already removed the errexit flag after this issue #64

Indeed, set -o errexit overwrites trap. This prevents me from saving the history and the env when there is an error. That is why some people do not recommend it.

(As far as I'm concerned, I always use it for simple scripts that don't handle errors)

I didn't encounter any bug with the git version, so I'll release a new version tonight (hopefully) :)

@npf
Copy link
Contributor

npf commented Mar 31, 2016

So can it be closed ?

@SalemHarrache
Copy link
Contributor

Yep :)

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

No branches or pull requests

6 participants