Process service allows you to start processes, track their output, and so on.
Allocates and returns a new Process object.
Frees the resources associated with the process. It is recommended to always call this function as soon as you are finished with the process.
Schedules the stdin channel of process to be closed. The channel will close once all data has been written to the process. After calling this function, any attempts to write to the process will do nothing. See
QProcess::closeWriteChannel() for more details.
exec(filePath: string, arguments: string, throwOnError: boolean): number
Executes the program at
filePath with the given argument list and blocks until the process is finished. If an error occurs (for example, there is no executable file at
Returns the exit code of the process. This is needed for retrieving the exit code from processes started via
start(), rather than
getEnv(varName: string): string
Returns the value of the variable
varName in the process' environment.
Kills the process, causing it to exit immediately.
Reads and returns one line of text from the process output, without the newline character(s).
Reads and returns all data from the process' standard error channel.
Reads and returns all data from the process' standard output channel.
Sets the text codec to
codec. The codec is used for reading and writing from and to the process, respectively. The supported codecs are the same as for
QTextCodec, for example: "UTF-8", "UTF-16", and "ISO 8859-1".
setEnv(varName: string, varValue: string): string
Sets the value of variable
varValue in the process environment. This only has an effect if called before the process is started.
setWorkingDirectory(path: string): void
Sets the directory the process will be started in. This only has an effect if called before the process is started.
start(filePath: string, arguments: string): boolean
Starts the program at
filePath with the given list of arguments. Returns
true if the process could be started and
Note: This call returns right after starting the process and should be used only if you need to interact with the process while it is running. Most of the time, you want to use
Tries to terminate the process. This is not guaranteed to make the process exit immediately; if you need that, use
waitForFinished(timeout: number): boolean
Blocks until the process has finished or
timeout milliseconds have passed (default is 30000). Returns true if the process has finished and false if the operation has timed out. Calling this function only makes sense for processes started via
start() (as opposed to
Returns the directory the process will be started in.
write(data: string): void
data into the process' input channel.
writeLine(data: string): void
data, followed by the newline character(s), into the process' input channel.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.