Skip to main content

Overview

Run shell commands (Linux) or PowerShell commands (Windows) in the sandbox.

Syntax

Parameters

string
required
The language to run: 'sh' (Shell/Linux) or 'pwsh' (PowerShell/Windows)
string
required
The code or the command to run
number
required
The timeout in milliseconds
boolean
default:"false"
If true, TestDriver does not show the output

Returns

Promise<string> - The command output

Shell Execution (Linux)

Run shell commands in the Linux sandbox.

Basic Commands

File Operations

PowerShell Execution (Windows)

Execute PowerShell commands in the Windows sandbox.

Software Installation

File Operations

Process Management

Environment Variables

Network Operations

Silent Execution

Suppress output for background operations:

Best Practices

Use appropriate timeouts
Handle errors gracefully
Use silent mode for background tasks
Escape strings properly in PowerShellUse proper escaping for special characters:

Complete Example