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

Allow arbitrary command (via child process?) #87

Open
sadams opened this issue Jan 12, 2021 · 2 comments · May be fixed by #88
Open

Allow arbitrary command (via child process?) #87

sadams opened this issue Jan 12, 2021 · 2 comments · May be fixed by #88

Comments

@sadams
Copy link

sadams commented Jan 12, 2021

I currently use wait-on for http but have to write something separate for other cases.

E.g. because mysql listens on it's port even when it's not ready to accept connections, i do something like this:

#!/usr/bin/env bash

set -e
i=0
while ! mysqladmin ping -h"$DB_HOST" --silent; do
	i=$((i+1))
	if [[ "$i" -gt '20' ]]; then
		echo "mysql failed to start"
		exit 1
	fi
	sleep 1
done

npx wait-on http://somehttpcheck 

But if wait-on supported a command resource i could do this:

npx wait-on http://somehttpcheck "command:mysqladmin ping -h$DB_HOST"

I'm not sure command is the right naming but hopefully the intention is clear.

@sadams sadams linked a pull request Jan 12, 2021 that will close this issue
@slavahatnuke
Copy link

@sadams I have the same need. By custom command (CLI) the need is quite easily covered.
@jeffbski is it possible to bump the topic up? Or what @sadams or me (@slavahatnuke) could resolve such a case?

I feel like the protocol could be command: it describes the thing.

And for example waiting for not-empty directory #96 could look like

  • EMPTY:wait-on command:"find /tmp/to-be-empty -maxdepth 0 -empty | grep tmp/to-be-empty"
  • NON-EMPTY:wait-on command:"find /tmp/to-be-empty -maxdepth 0 | grep tmp/to-be-empty"

It covers a few topics at once in the issues

For Linux family systems the tool is brilliant.

For Windows, it could take more effort to cover all mentioned needs in the issues.

I feel like a lot of people are using wait-on in CI/dev/staging environments that are in node.js naturally Linux-based and this solution has a huge impact.

So, wait-on command:"any-command" looks quite promising and I would like to ask you @jeffbski to help.

@slavahatnuke
Copy link

@jeffbski I follow up, about improving the functionality of the wait-on command, could you help with the question or it's needed to be forked?

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 a pull request may close this issue.

2 participants