ExternalProcess

Inherits from: Object

Execute external system processes from Maggie.

ExternalProcess wraps Go's os/exec package, providing synchronous and asynchronous process execution with stdout/stderr capture, environment injection, working directory control, and timeouts.

Example
"Quick one-liner: run a command and get stdout"
ExternalProcess run: 'echo' args: #('hello world')
"=> 'hello world\n'"
Example
"Run git status in a specific directory"
| p <ExternalProcess> |
p := (ExternalProcess command: 'git' args: #('status' '--short'))
    dir: '/path/to/repo'.
p run.
p stdout   "=> '...\n'"
p exitCode "=> 0"
Example
"Async process with wait"
| p <ExternalProcess> |
p := (ExternalProcess command: 'sleep' args: #('1')) start.
p isDone   "=> false"
p wait.
p isDone   "=> true"
Example
"Environment variable injection"
| p <ExternalProcess> |
p := (ExternalProcess command: 'env')
    env: (Dictionary new at: 'MY_VAR' put: 'hello'; yourself).
p run.
p stdout   "=> '...MY_VAR=hello...'"
Example
"Run with timeout (kills process after N ms)"
| p <ExternalProcess> |
p := (ExternalProcess command: 'sleep' args: #('60'))
    runWithTimeout: 100.
p exitCode "=> -1 (killed)"

Class Methods

primitives

class command:
class command:args:
class run:args:

Instance Methods

primitives

args:
command
dir:
env:
exitCode
isDone
isSuccess
kill
printString
run
runWithTimeout:
start
stderr
stdout
wait