Skip to content
This repository was archived by the owner on May 30, 2018. It is now read-only.

make bash stricter#23

Open
groob wants to merge 1 commit intokolide:masterfrom
groob:wait_mysql
Open

make bash stricter#23
groob wants to merge 1 commit intokolide:masterfrom
groob:wait_mysql

Conversation

@groob
Copy link
Contributor

@groob groob commented Feb 15, 2017

Closes #15

Copy link
Contributor

@zwass zwass left a comment

Choose a reason for hiding this comment

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

This change appears to cause the script to exit when we wait for MySQL to accept connections. Repros consistently for me if I do ./demo.sh reset && ./demo.sh up

@groob
Copy link
Contributor Author

groob commented Feb 15, 2017

Trying to figure it out since -e will fail with non-zero exist status, but that's what we use to check for mysql connectivity.

I'll give it some thought and see if I can come up with a strategy. One way we could achieve this would be to move the for loop into a script which runs in the container, instead of initializing a new one. That way it will exit 0 when it finally connects, or exit 1 if 50 attempts failed.

@zwass
Copy link
Contributor

zwass commented Feb 15, 2017

Is the current strategy of manually handling the exit not sufficient? I am also concerned that -e will exit with no error printed.

@groob
Copy link
Contributor Author

groob commented Feb 15, 2017

The reason the error is not printed is because we pipe the docker output to > /dev/null

IMO it's important to close #15, I've run into a few cases already where the port is being used(mostly because I test this set up over and over in a new folder) and the experience is pretty poor. The loop doesn't handle SIGINT well, so hitting CTRL+C doesn't help.

As far as how -e works, It will abort the rest of the script if the last command in a pipe exits non-zero. If there's a different straegy for handling it, we can try.

@directionless
Copy link

FWIW I usually handle this by setting -e globally, and toggling it off for specific places I need to check something. (set +e)

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.

3 participants