API: command
Source:
platform/command.ts
Provides a wrapper for executing system commands via the platform's CommandEngine.
Usage
import { command } from "sdk/platform";
import { response } from "sdk/http";
let result = command.execute("echo 'hello dirigible!'");
response.println("[Result]: " + result);
response.flush();
response.close();Classes
Command
@class Command
@description Static utility class for executing system commands.
Methods
execute
execute (command:string, options?:CommandOptions, add?:EnvironmentVariables, remove?:string[]):CommandOutputExecutes a system command with specified configuration, environment variables, and exclusions.
@param {string} command The command string to execute (e.g., "ls -l").
@param {CommandOptions} [options] Optional configuration for the execution environment.
@param {EnvironmentVariables} [add] Optional environment variables to add to the process.
@param {string[]} [remove] Optional list of environment variable keys to remove from the process.
@returns {CommandOutput} A structured object containing the exit code and output streams.