Platforms to show: All Mac Windows Linux Cross-Platform
ShellMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Shell | MBS Util Plugin | 19.2 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Example:
Dim s As New ShellMBS
s.Execute "/usr/bin/whoami"
s.Wait 5
Dim output As String = s.ReadOutput
Dim errors As String = s.ReadError
Break // see in debugger
MsgBox "whoami: "+output
Via input stream, we can send data to the process.
And via output and error streams, we can read data coming back.
While this class does the same as Shell class in Xojo, we have the possibility to add more in the future.
For now you can benefit from an alternative implementation with stderr and stdout as two streams. Also we feature terminate methods to kill the child process.
See also WindowsProcessMBS, WindowsShellExecuteAsAdminMBS and WindowsShellExecuteMBS (Windows only), ConsoleExecuteMBS and NSTaskMBS (Mac only).
- 2 events
- event Completed
- event DataAvailable(AvailableBytesError as Integer, AvailableBytesOutput as Integer)
- 15 properties
- property ApplicationName as String
- property AvailableBytesError as Integer
- property AvailableBytesOutput as Integer
- property CurrentDirectory as String
- property Domain as String
- property Environment as Dictionary
- property ErrorCode as Integer
- property Executable as String
- property IsRunning as Boolean
- property Password as String
- property PID as Integer
- property ProcessHandle as Integer
- property Tag as Variant
- property ThreadHandle as Integer
- property Username as String
- 14 methods
- method Arguments as String()
- method CloseInput
- method CloseStreams
- method Constructor
- method Destructor
- method Execute(Executable as String)
- method ExitCode as Integer
- method Poll
- method ReadError as String
- method ReadOutput as String
- method SetArguments(arguments() as String)
- method Terminate(WinExitCode as Integer = 255) as boolean
- method Wait(TimeOut as double = 30.0)
- method WriteInput(data as string) as Integer
This class has no sub classes.
Some examples using this class:
Blog Entries
- News from the MBS Xojo Plugins in Version 23.0
- MBS Xojo Plugins, version 23.0pr8
- MBS Xojo Plugins, version 22.6pr1
- MonkeyBread Software Releases the MBS Xojo Plugins in version 21.2
- MBS Xojo Plugins, version 21.2pr6
- MBS Xojo Plugins, version 20.1pr1
- MBS Xojo Plugins, version 19.5pr1
- MBS Xojo Plugins in version 19.2
- MBS Xojo Plugins, version 19.2pr6
Xojo Developer Magazine
Videos
The items on this page are in the following plugins: MBS Util Plugin.
SharingPanelMBS - SignalHandlerMBS
