Killing Processes
Terminates the specified ports, port ranges and process IDs.
History
Version | Changes |
---|---|
v2.5.0 | --kill-port in order to --killPort .--kill-range in order to --killRange .--kill-pid in order to --killPid . |
kill.portβ
kill.port(port: number | number[])
Terminates the specified ports.
- Requires
lsof
for Unix andnetstat
for Windows.
CLIβ
Terminates the specified ports before running the test suite.
npx poku --killPort="4000" targetPath
Also, terminating multiple ports:
npx poku --killPort="4000,4001" targetPath
APIβ
import { kill } from 'poku';
await kill.port(4000);
Also, terminating multiple ports:
await kill.port([4000, 4001]);
kill.rangeβ
kill.range(startsAt: number, endsAt: number)
Terminates the specified port range.
- Requires
lsof
for Unix andnetstat
for Windows.
CLIβ
Terminates the specified port range before running the test suite.
npx poku --killRange="4000-4100" targetPath
Also, terminating multiple port ranges:
npx poku --killRange="4000-4100,5000-5100" targetPath
APIβ
import { kill } from 'poku';
await kill.range(4000, 4100);
kill.pidβ
kill.pid(PID: number | number[])
Terminates the specified processes.
CLIβ
Terminates the specified processes before running the test suite
npx poku --killPid="100" targetPath
Also, terminating multiple processes:
npx poku --killPid="100,200" targetPath
APIβ
import { kill } from 'poku';
await kill.pid(100);
Also, terminating multiple processes:
await kill.pid([100, 200]);
If your environment doesn't include lsof
by default:
macOS (Homebrew)
brew install lsof
Debian, Ubuntu, etc.
sudo apt-get install lsof
Arch Linux, etc.
sudo pacman -S lsof
Alpine Linux, etc.
apk add lsof