diff options
author | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2016-03-30 12:53:31 +0200 |
---|---|---|
committer | Frerich Raabe <raabe@froglogic.com> | 2016-03-30 21:13:03 +0000 |
commit | ba145f6090f481a41e7a476355c83039ed8ff521 (patch) | |
tree | 95de65d51e258c65d2ab5adf9d275cb5717bb229 /doc | |
parent | 6e904b95bd15b542fb7dc846c80ec705c9155d51 (diff) |
Make communication via installer.execute() Unicode safe
It was impossible to pass Unicode data safely to a process started via
installer.execute(), or to read Unicode data printed by that process
safely back in. The reason for this is that the code hardcoded the
latin1 codec for converting between strings used in the script
interpreter and bytes used by the QProcessWrapper API.
Fix this by adding two new optional arguments to installer.execute()
which can be used to define the codec to be used for writing to stdin
resp. reading from stdout. This defaults to latin1 for backwards
compatibility.
Change-Id: I290d8d9617b286ef90b2f0a05c6e7a47f6df317f
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Reviewed-by: Frerich Raabe <raabe@froglogic.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/scripting-api/packagemanagercore.qdoc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/doc/scripting-api/packagemanagercore.qdoc b/doc/scripting-api/packagemanagercore.qdoc index 418dbdf14..66441fce5 100644 --- a/doc/scripting-api/packagemanagercore.qdoc +++ b/doc/scripting-api/packagemanagercore.qdoc @@ -505,13 +505,20 @@ /*! \qmlmethod array installer::execute(string program, stringlist arguments = undefined, - string stdin = "") + string stdin = "", string stdinCodec = "latin1", + string stdoutCodec = "latin1") Starts the program \a program with the arguments \a arguments in a new process and waits for it to finish. \a stdin is sent as standard input to the application. + \a stdInCodec is the name of the codec to use for converting the input string + into bytes to write to the standard input of the application. + + \a stdOutCodec is the name of the codec to use for converting data written by the + application to standard output into a string. + Returns an empty array if the program could not be executed, otherwise the output of command as the first item, and the return code as the second. |