ProcessObject

ProcessObject[]

is an object that represents a runnable external process.

ProcessObject[pid]

represents the running external process with PID pid on your computer system.

Details

  • ProcessObject can be created by StartProcess.
  • For processes started by StartProcess, ProcessObject can be used in place of a stream in functions like Read, Write, BinaryRead, and Import.
  • ProcessObject can represent both a running process and a process that has ended.
  • ProcessObject[]["prop" ] gives properties of external processes. Possible properties include:
  • "PID"process ID
    "PPID"parent process ID
    "Memory"memory the process is using
    "StartTime"date the process was started
    "RealTime"time since the process started
    "SystemTime"CPU time spent in kernel space
    "UserTime"CPU time spent in user space
    "Threads"number of threads
    "User"the user the process belongs to
    "Program"name of the program
    "Path"full file path of the program
    "Dataset"dataset of all properties and values
    "Properties"list of available properties

Examples

Basic Examples  (2)

Use StartProcess to start the shell process and get the corresponding ProcessObject:

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

Write a command into the shell process using the corresponding ProcessObject:

In[3]:=
Click for copyable input

Read a single line of shell output:

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

Start five system shell processes:

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

Display information about all the started processes in a grid:

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

See Also

Processes  StartProcess  ReadLine  WriteLine  ReadString  ReadByteArray  InputStream  OutputStream  LinkObject  SystemProcesses  SystemProcessData  $ProcessID

Introduced in 2014
(10.0)
| Updated in 2018
(11.3)