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
  • In addition to the properties above, Information of a ProcessObject may include the following:
  • "ExitCode"exit code for the process

Examples

Basic Examples  (2)

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

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

Read a single line of shell output:

Start five system shell processes:

Display information about all the started processes in a grid:

Wolfram Research (2014), ProcessObject, Wolfram Language function, https://reference.wolfram.com/language/ref/ProcessObject.html (updated 2019).

Text

Wolfram Research (2014), ProcessObject, Wolfram Language function, https://reference.wolfram.com/language/ref/ProcessObject.html (updated 2019).

CMS

Wolfram Language. 2014. "ProcessObject." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/ProcessObject.html.

APA

Wolfram Language. (2014). ProcessObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ProcessObject.html

BibTeX

@misc{reference.wolfram_2024_processobject, author="Wolfram Research", title="{ProcessObject}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/ProcessObject.html}", note=[Accessed: 09-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_processobject, organization={Wolfram Research}, title={ProcessObject}, year={2019}, url={https://reference.wolfram.com/language/ref/ProcessObject.html}, note=[Accessed: 09-November-2024 ]}