new (cmd:String, ?args:Array<String>)

Construct a Process object, which run the given command immediately.

Command arguments can be passed in two ways: 1. using args, 2. appending to cmd and leaving args as null.

  1. When using args to pass command arguments, each argument will be automatically quoted, and shell meta-characters will be escaped if needed. cmd should be an executable name that can be located in the PATH environment variable, or a path to an executable.

  2. When args is not given or is null, command arguments can be appended to cmd. No automatic quoting/escaping will be performed. cmd should be formatted exactly as it would be when typed at the command line. It can run executables, as well as shell commands that are not executables (e.g. on Windows: dir, cd, echo etc).

close() should be called when the Process is no longer used.


read onlystderr:Input

Standard error. The output stream to output error messages or diagnostics.

read onlystdin:Output

Standard input. The stream data going into a process.

read onlystdout:Input

Standard output. The output stream where a process writes its output data.


close ():Void

Close the process handle and release the associated resources. All Process fields should not be used after close() is called.

exitCode ():Int

Block until the process exits and return the exit code of the process. If the process has already exited, return the exit code immediately.

getPid ():Int

Return the process ID.

kill ():Void

Kill the process.