Skip to main content

ReadyCmd

Class for ready check commands.

Constructors

Parameters
ParameterType
cmdstring
Returns
ReadyCmd

Methods

getCmd()

Returns
string

Functions

waitForFile()

Wait for a file to exist. Uses shell test command to check file existence.

Parameters

ParameterTypeDescription
filenamestringPath to the file to wait for

Returns

ReadyCmd ReadyCmd that checks for the file

Example


waitForPort()

Wait for a port to be listening. Uses ss command to check if a port is open and listening.

Parameters

ParameterTypeDescription
portnumberPort number to wait for

Returns

ReadyCmd ReadyCmd that checks for the port

Example


waitForProcess()

Wait for a process with a specific name to be running. Uses pgrep to check if a process exists.

Parameters

ParameterTypeDescription
processNamestringName of the process to wait for

Returns

ReadyCmd ReadyCmd that checks for the process

Example


waitForTimeout()

Wait for a specified timeout before considering the sandbox ready. Uses sleep command to wait for a fixed duration.

Parameters

ParameterTypeDescription
timeoutnumberTime to wait in milliseconds (minimum: 1000ms / 1 second)

Returns

ReadyCmd ReadyCmd that waits for the specified duration

Example


waitForURL()

Wait for a URL to return a specific HTTP status code. Uses curl to make HTTP requests and check the response status.

Parameters

ParameterTypeDefault valueDescription
urlstringundefinedURL to check (e.g., ‘http://localhost:3000/health’)
statusCodenumber200Expected HTTP status code (default: 200)

Returns

ReadyCmd ReadyCmd that checks the URL

Example