execWithTimeout


Description:

public static Result<ShellResult,Error> execWithTimeout (string command, Duration timeout)

Executes a command with timeout.

This method uses coreutils `timeout` command on POSIX environments.

Parameters:

command

shell command.

timeout

timeout duration.

Returns:

Result.ok(execution result), or Result.error(ShellError.INVALID_ARGUMENT) when timeout is negative.