ExternalEvaluate likes to print whatever hits stdout or stderr in the course of evaluation. For example,

In[1]= ExternalEvaluate["Shell", "echo 'hi!'"]
Out[1]= Success[...]

I'd like to suppress this printed output and just extract the stdout from the actual output. How can I do that?

I would have hoped there would be an analogue of e.g. QuietEcho or an option for ExternalEvaluate that controls this, but I couldn't find either.

I'm guessing it will involve finding a way to intercept $Output somehow?

  • 2
    $\begingroup$ Have you trie Block[{Print}, code]? $\endgroup$
    – Jason B.
    Jan 12, 2023 at 1:01
  • $\begingroup$ @JasonB. Oh, yup, that did it! I guess I didn't expect Print to be used internally! $\endgroup$
    – thorimur
    Jan 12, 2023 at 2:09

1 Answer 1


ExternalEvaluate will attempt to route any external print-like output directly to Print. To disable this you can just Block that symbol during evaluation:

In[2]:= Block[{Print},
 ExternalEvaluate["Shell", "echo 'hi!'"]

Out[2]= Success["ExecutionCompleted", <|...|>]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.