ProcessConnection

ProcessConnection[proc,"stream"]
returns the stream object for a given stream.

DetailsDetails

  • Possible stream values are:
  • "StandardInput"a stream that can be written to which the process will read from
    "StandardOutput"a stream that can be read from to which the process will write
    "StandardError"an error stream that can be read from to which the process will write

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Start the system shell process:

In[1]:=
Click for copyable input
Out[1]=

Write a shell command:

In[2]:=
Click for copyable input

Read the shell command output:

In[3]:=
Click for copyable input
Out[3]=

Write an invalid shell command:

In[4]:=
Click for copyable input

Use ProcessConnection to read from the standard error stream:

In[5]:=
Click for copyable input
Out[5]=

Start the system shell process:

In[1]:=
Click for copyable input
Out[1]=

Get the standard input stream using ProcessConnection:

In[2]:=
Click for copyable input
Out[2]=

Get the standard output stream using ProcessConnection:

In[3]:=
Click for copyable input
Out[3]=

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

In[4]:=
Click for copyable input
In[5]:=
Click for copyable input

Read the two command outputs:

In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
Introduced in 2014
(10.0)