Merge pull request 'feat(repl): Replace StdIO when executing IO-based monads' (#231) from repl/replace-io into dev

Reviewed-on: #231
This commit is contained in:
Leni Aniva 2025-07-08 14:30:50 -07:00
commit d85c804133
1 changed files with 4 additions and 1 deletions

View File

@ -267,7 +267,10 @@ def execute (command: Protocol.Command): MainM Json := do
try
match fromJson? command.payload with
| .ok args => do
match (← comm args |>.run) with
let (msg, result) ← IO.FS.withIsolatedStreams (isolateStderr := false) $ comm args
if !msg.isEmpty then
IO.eprint s!"stdout: {msg}"
match result with
| .ok result => return toJson result
| .error ierror => return toJson ierror
| .error error => return toJson $ errorCommand s!"Unable to parse json: {error}"