({{, (RefLink[ProcessConnection, paclet:ref/ProcessConnection])[proc,"stream"]
returns the stream object for a given stream.}})

OpenersNotesSection(Spacer1)Details

Possible stream values are:

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Start the system shell process:

process=StartProcess[$SystemShell]

Write a shell command:

WriteLine[process,"echo some text for standard output"];

Read the shell command output:

ReadLine[process]

Write an invalid shell command:

WriteLine[process,"invalid command"];

Use (RefLink[ProcessConnection, paclet:ref/ProcessConnection]) to read from the standard error stream:

ReadLine[ProcessConnection[process,"StandardError"]]

Start the system shell process:

process=StartProcess[$SystemShell]

Get the standard input stream using (RefLink[ProcessConnection, paclet:ref/ProcessConnection]):

input=ProcessConnection[process,"StandardInput"]

Get the standard output stream using (RefLink[ProcessConnection, paclet:ref/ProcessConnection]):

output=ProcessConnection[process,"StandardOutput"]

Write two commands into the shell. A process and its streams can be used interchangeably in most cases:

WriteLine[input,"echo line 1"];

WriteLine[process,"echo line 2"];

Read the two command outputs:

ReadLine[process]

ReadLine[output]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ProcessInformation, paclet:ref/ProcessInformation])  ▪  (RefLink[ProcessStatus, paclet:ref/ProcessStatus])  ▪  (RefLink[KillProcess, paclet:ref/KillProcess])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Direct Control of External Processes, paclet:guide/DirectControlOfExternalProcesses])}, {▪(RefLinkPlain[Calling External Programs, paclet:guide/CallingExternalPrograms])}})}})