Skip to content

bash

import { bash, waitPort } from 'sysopkit/op/bash';

Executes a command string via bash -c. Same exit code handling as sh().

const result = await bash('for i in {1..3}; do echo $i; done');

Waits for a TCP port to open or close using bash /dev/tcp:

await waitPort({ port: 80, host: 'localhost', state: 'open', delay: 1000 });

Options:

OptionDefaultDescription
portPort number (required)
hostlocalhostHost to check
state'open''open' or 'closed'
delay5000Poll interval in ms