Cmd

Moduleejs.sys
Definition class Cmd
InheritanceCmd inherit Object
Specifiedejscript-1.1
StabilityPrototype.

The Cmd class supports invoking other programs on the same system.

This class is prototype and will likely change in the next release.


Properties

QualifiersPropertyTypeDescription
No properties defined

Cmd Methods

QualifiersMethod
public static daemon(cmdline: String): Number
 Execute a command and detach.
public static locate(program: Path): Path
 Locate a command along the system search PATH.
public static run(cmdline: String, data: String = null): String
 Execute a command/program.
public static sh(cmdline: String, data: String = null): String
 Run a command using the system command shell and wait for completion.

Method Detail

static public daemon(cmdline: String): Number

Execute a command and detach.

Description
This will not capture output nor will it wait for the command to complete.
Parameters
cmdline: String Command or program to execute.
Returns
The commands process ID.

static public locate(program: Path): Path

Locate a command along the system search PATH.

Parameters
program: Path Program to search for.
Returns
The first located occurence of the command on the PATH.

static public run(cmdline: String, data: String = null): String

Execute a command/program.

Parameters
cmdline: String Command or program to execute.
data: String Optional data to write to the command on it's standard input. Not implemented.
Returns
The command output from it's standard output.
Throws
IOError: if the command exits with non-zero status. The exception object will contain the command's standard error output.

static public sh(cmdline: String, data: String = null): String

Run a command using the system command shell and wait for completion.

Description
This supports pipelines.
Parameters
cmdline: String Command or program to execute.
data: String [default: null]
Returns
The command output from it's standard output.
Throws
IOError: if the command exits with non-zero status. The exception object will contain the command's standard error output.