The os.process package provides process operation interfaces, including process creation, standard stream obtaining, process waiting, and process information query.
This package provides unified control capabilities for multiple platforms, including Linux, macOS, Windows, and HarmonyOS.
Name Description
CurrentProcess Specifies the current process class inherited from the Process
class and providing functions related to operations on the current process.
Process Specifies a process class which provides functions related to process operations.
SubProcess Specifies a subprocess class inherited from the Process
class and providing functions related to subprocess operations.
Name Description
ProcessRedirect Sets the redirection mode of the subprocess standard stream when a process is created.
Name Description
ProcessException Specifies an exception class of the os.process
package.
Member Supported on
current Linux, Windows, macOS, and HarmonyOS
pid Linux, Windows, macOS, and HarmonyOS
name Linux, Windows, macOS, and HarmonyOS
command Linux, Windows, macOS, and HarmonyOS
arguments Linux, macOS, and HarmonyOS
commandLine Linux, macOS, and HarmonyOS
workingDirectory Linux, macOS, and HarmonyOS
environment Linux and HarmonyOS
of(Int64) Linux, Windows, macOS, and HarmonyOS
start(String, Array, Path, Map<String, String>, ProcessRedirect, ProcessRedirect, ProcessRedirect) Linux, Windows, macOS, and HarmonyOS
run(String, Array, Path, Map<String, String>, ProcessRedirect, ProcessRedirect, ProcessRedirect, Duration) Linux, Windows, macOS, and HarmonyOS
runOutput(String, Array, Path, Map<String, String>, ProcessRedirect, ProcessRedirect, ProcessRedirect) Linux, Windows, macOS, and HarmonyOS
terminate(Bool) Linux, Windows, macOS, and HarmonyOS
Member Supported on
stdIn Linux, Windows, macOS, and HarmonyOS
stdOut Linux, Windows, macOS, and HarmonyOS
stdErr Linux, Windows, macOS, and HarmonyOS
atExit(() -> Unit) Linux, Windows, macOS, and HarmonyOS
exit(Int64) Linux, Windows, macOS, and HarmonyOS
Member Supported on
stdIn Linux, Windows, macOS, and HarmonyOS
stdOut Linux, Windows, macOS, and HarmonyOS
stdErr Linux, Windows, macOS, and HarmonyOS
wait(Duration) Linux, Windows, macOS, and HarmonyOS
waitOutput() Linux, Windows, macOS, and HarmonyOS