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

It doesn't catch exit code #39

Closed
oshliaer opened this issue Jan 23, 2021 · 4 comments
Closed

It doesn't catch exit code #39

oshliaer opened this issue Jan 23, 2021 · 4 comments

Comments

@oshliaer
Copy link

runnerfile

#!/usr/bin/env bash

cd "$(dirname "$0")" || exit
source ./runner

task_bar() {
    exit 0
}

invocation

$> ./runnerfile bar
[10:38:51.574] Starting 'bar'...

There is no 'Finished' log

How can I settings this for valid fulfilled invocation?

@stylemistake
Copy link
Owner

You are exiting in the middle of the task, so that's expected. What you want is "return".

@oshliaer
Copy link
Author

I would like to go back up the call stack. Maybe I can pass some value to the script or should I use conditional branching?

I look at the code of runner and I realize that I cannot interrupt the script with exit.

@stylemistake
Copy link
Owner

If you return a non-zero value, task will fail and bring all other dependent tasks down. You can also use set -e, but i'm not sure how that behaves on current master.

@oshliaer
Copy link
Author

Thank you!

It's expected for me now.

So in general it's a good app!

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

No branches or pull requests

2 participants