4
$\begingroup$

When you run an external program using RunProcess, the program will run to completion and you will receive an association containing the exit code, stuff that went to standard error, and stuff that went to standard output. Useful stuff!

However, if you start a process with StartProcess and get a returned ProcessObject, you can read from standard output just by using ReadString and friends with the process object itself, but there seems to be no way to get to standard output. This seems like a strange limitation. Am I missing something?

$\endgroup$
3
$\begingroup$

Use ProcessConnection.

process = StartProcess[$SystemShell]

ProcessConnection[process, "StandardError"]

This returns an InputStream object. "StandardInput" and "StandardOutput" can be retrieved the same way.

$\endgroup$
  • 1
    $\begingroup$ I did not know this. I researched this right now. $\endgroup$ – Szabolcs Mar 31 '17 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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