feat(repl): Replace StdIO when executing IO-based monads #231
|
@ -267,7 +267,10 @@ def execute (command: Protocol.Command): MainM Json := do
|
||||||
try
|
try
|
||||||
match fromJson? command.payload with
|
match fromJson? command.payload with
|
||||||
| .ok args => do
|
| .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
|
| .ok result => return toJson result
|
||||||
| .error ierror => return toJson ierror
|
| .error ierror => return toJson ierror
|
||||||
| .error error => return toJson $ errorCommand s!"Unable to parse json: {error}"
|
| .error error => return toJson $ errorCommand s!"Unable to parse json: {error}"
|
||||||
|
|
Loading…
Reference in New Issue