B4J Programming Press on the image to return to the main documentation page.

jShell

List of types:

Shell
ShellSyncResult

Shell

Shell provides methods to start new processes and run other applications.
The execution is asynchronous. The ProcessCompleted event is raised after the process has exited.

Events:

ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
StdOut (Buffer() As Byte, Length As Int)
StdErr (Buffer() As Byte, Length As Int)

Members:


  Arguments() As String [read only]

  Encoding As String [write only]

  Executable As String [read only]

  GetTempErr As String

  GetTempOut As String

  Initialize (EventName As String, Executable As String, Args As List)

  InitializeDoNotHandleQuotes (EventName As String, Executable As String, Args As List)

  InputStreamEnabled As Boolean

  IsInitialized As Boolean

  KillProcess

  Run (TimeoutMs As Long)

  RunSynchronous (TimeoutMs As Long) As ShellSyncResult

  RunWithOutputEvents (TimeoutMs As Long)

  SetEnvironmentVariables (Vars As Map)

  WorkingDirectory As String

  WriteToInputStream (Data() As Byte)

Members description:

Arguments() As String [read only]
Gets the command line arguments.
Encoding As String [write only]
Sets the encoding used. This encoding should match the process output encoding.
The default value is UTF8.
Executable As String [read only]
Gets the executable file name.
GetTempErr As String
Returns the current error output. Should only be used when the process was started with Run (not RunWithOutputEvents).
GetTempOut As String
Returns the current output. Should only be used when the process was started with Run (not RunWithOutputEvents).
Initialize (EventName As String, Executable As String, Args As List)
Initializes the object.
EventName - Determines the sub that will handle the events.
Executable - Executable file to run.
Args - List of command line arguments. Pass Null if not needed.
InitializeDoNotHandleQuotes (EventName As String, Executable As String, Args As List)
InputStreamEnabled As Boolean
Gets or sets whether the process input stream will be open for communication.
You can use WriteToInputStream to write data while the process is running.
IsInitialized As Boolean
KillProcess
Kills the process if it is currently running.
Run (TimeoutMs As Long)
Starts the process.
TimeoutMs - Timeout in milliseconds. Pass -1 to disable the timeout.
RunSynchronous (TimeoutMs As Long) As ShellSyncResult
Starts the process and waits for it to complete.
RunWithOutputEvents (TimeoutMs As Long)
Starts the process. The StdOut and StdErr events will be raised when new data is available.
Note that these events are raised on a background thread.
SetEnvironmentVariables (Vars As Map)
Set the system environment variables that will be passed to the child process.
Example:
shl.SetEnvironmentVariables(CreateMap("ZZZ": "abc", "YYYY": "213"))
WorkingDirectory As String
Gets or sets the process working directory.
WriteToInputStream (Data() As Byte)
Writes data to the process input stream.

ShellSyncResult


Events:

None

Members:


  ExitCode As Int

  StdErr As String

  StdOut As String

  Success As Boolean

Members description:

ExitCode As Int
StdErr As String
StdOut As String
Success As Boolean

Top