eiriksm / wait-for-listen
Waits until a port is listening.
Installs: 82 522
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 0
Requires (Dev)
- phpunit/phpunit: ~5.7.21
- satooshi/php-coveralls: ^1.0
This package is auto-updated.
Last update: 2024-10-23 15:14:30 UTC
README
Installation
composer require eiriksm/wait-for-listen
...or probably you want this as a dev requirement:
composer require eiriksm/wait-for-listen --dev
Usage
This package is useful to use in CI setups before your tests assume a service has started.
So instead of this:
- ./some-slow-starting-task-that-exposes-port 8000 &
- sleep 5
- composer test
You can now use this:
- ./some-slow-starting-task-that-exposes-port 8000 &
- ./vendor/bin/wait-for-listen 8000
Configuration
wait-for-listen
has 3 options. Port, host and timeout.
They are specified like this:
./vendor/bin/wait-for-listen <port> [host] [timeout]
Port (required)
Specify a port to wait for.
Host (optional)
Specify an optional host. The default is 127.0.0.1
.
Timeout (optional)
Specify a timeout. The default is 10.
Licence
WTFPL.