Script Class
Package: GHIElectronics.Endpoint.Core
Namespace: GHIElectronics.Endpoint.Core
Runs an external program and collects what it prints. Used internally by the Endpoint libraries where a direct API is not yet available; prefer the direct API where one exists.
class Script: ...
Nested Types
| Type | Kind | Summary |
|---|---|---|
| Script.OutputDataReceivedEventHandler | Delegate | Signature for the Script.OutputDataReceived event. |
Constructors
Script(string filename, string workingdir, string arguments)
def __init__(self, filename: str, workingdir: str, arguments: str):
Prepares to run filename with the given arguments and working directory.
| Parameter | Type | Description |
|---|---|---|
filename | string | Path to the program, or a name that PATH resolves. |
workingdir | string | Working directory for the program; empty for the current one. |
arguments | string | Command-line arguments as a single string, split by the shell convention. |
Properties
Error
Error: str # @property
Everything the program has printed to standard error so far, newline-separated.
Returns string
ExitCode
ExitCode: int # @property
The program's exit code; -1 if it could not be started
Returns int
IsBusy
IsBusy: bool # @property
True while the program is running (between Script.Start and the program's exit).
Returns bool
Output
Output: str # @property
Everything the program has printed to standard output so far, newline-separated.
Returns string
Methods
Start(bool waitforexit)
def Start(self, waitforexit: bool) -> None:
Starts the program and, unless told otherwise, waits until it ends
Stop()
def Stop(self) -> None:
Ends the program (and what it started)
Events
OutputDataReceived
OutputDataReceived # += / -= handler
Each line the program prints, as it prints it