Skip to main content
Version: v2.x.x

Killing Processes

Terminates the specified ports, port ranges and process IDs.

History
VersionChanges
v2.5.0
CLI: deprecate --kill-port in order to --killPort.
CLI: deprecate --kill-range in order to --killRange.
CLI: deprecate --kill-pid in order to --killPid.

kill.port​

kill.port(port: number | number[])

Terminates the specified ports.

  • Requires lsof for Unix and netstat 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 and netstat 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]);

tip

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