Shell
MMO\core\server · 1 symbol · generated 5 Oct 2026
Shell
Shell.php:12Run local shell commands via Process, exposing just the latest run's output/exit code.
- Namespace
MMO\core\server- Implements
- iShell
- Uses traits
- tSingleton
Index
| process | ||
| close() | Forget the last run process. | |
| debugName() | ||
| exec($cmd, $cwd) | Execute command WARNING: the command cd DOES NOT work. | |
| execSafe($cmd, $error, $cwd) | Run $cmd, never throwing on a non-zero exit code (see exec for that). | |
| getExitCode() | ||
| getProcess() | ||
| Instantiate($config) static | (Re)create the shared instance immediately, configured with $config merged into the class's existing config. | |
| IsShared() static | ||
| Shared() static | Get the shared instance, creating (and configuring) it on first call. | |
| Unshare($serialize) static | Remove the shared instance, so the next Shared() call creates a fresh one. | |
| __construct() | a singleton: Shared(), never new Shell() |
Properties1
process
Methods11
close()
Shell.php:67Forget the last run process.
| returns | void |
debugName()
Shell.php:21| returns | string |
exec($cmd, $cwd)
Shell.php:47Execute command WARNING: the command cd DOES NOT work. You need to set the cwd parameter
execSafe($cmd, $error, $cwd)
Shell.php:32Run $cmd, never throwing on a non-zero exit code (see exec for that).
getExitCode()
Shell.php:57getProcess()
Shell.php:62Instantiate($config)
statictSingleton.php:61(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
| $config = [] | array | config values merged in before the instance is constructed |
| returns | static | the newly (re)created shared instance |
IsShared()
statictSingleton.php:49| returns | bool | true if the shared instance has already been created (a call to Shared() would not need to construct a new one) |
Shared()
statictSingleton.php:22Get the shared instance, creating (and configuring) it on first call.
| returns | static |
Unshare($serialize)
statictSingleton.php:35Remove the shared instance, so the next Shared() call creates a fresh one.
- See
serialize) and kept as the class's config, so the next instance created picks up where this one left off; if false, the instance is simply discarded and the next one starts from the class's original config
| $serialize = true | bool | if true (the default) and an instance currently exists, it is serialized first (via |
| returns | bool | true if an instance actually existed and was removed |
__construct()
Shell.php:16a singleton: Shared(), never new Shell()