diff options
author | Dmitry Sokolov <sokolov_d_s@mail.ru> | 2019-02-14 11:12:18 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-02-19 10:41:14 +0000 |
commit | 55e31e6389c78218f1f9039a4bf642db68a86975 (patch) | |
tree | 1715d0ec47638196cfb9d7813721f3e530e730fc /src/tools | |
parent | 36a294d1aa18ba67989d505eadf4b9c2012c0c9e (diff) |
Kludge popen/pclose calls on MS-Win
For MS Visual Studio we need to use _popen() and _pclose() instead of
the POSIX functions; and the pipe needs to be opened in binary mode.
Change-Id: Ide0fb26a1e5f121b384b0baaf8100f26c614ccc6
Fixes: QTBUG-73810
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 712a8091fb..b0df833b87 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -43,6 +43,15 @@ #include <QRegExp> #include <algorithm> + +#ifdef Q_CC_MSVC +#define popen _popen +#define QT_POPEN_READ "rb" +#define pclose _pclose +#else +#define QT_POPEN_READ "r" +#endif + static const bool mustReadOutputAnyway = true; // pclose seems to return the wrong error code unless we read the output void deleteRecursively(const QString &dirName) @@ -70,7 +79,7 @@ FILE *openProcess(const QString &command) QString processedCommand = command; #endif - return popen(processedCommand.toLocal8Bit().constData(), "r"); + return popen(processedCommand.toLocal8Bit().constData(), QT_POPEN_READ); } struct QtDependency @@ -1721,7 +1730,7 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) .arg(shellQuote(rootPath)) .arg(importPaths.join(QLatin1Char(' '))); - FILE *qmlImportScannerCommand = popen(qmlImportScanner.toLocal8Bit().constData(), "r"); + FILE *qmlImportScannerCommand = popen(qmlImportScanner.toLocal8Bit().constData(), QT_POPEN_READ); if (qmlImportScannerCommand == 0) { fprintf(stderr, "Couldn't run qmlimportscanner.\n"); return false; @@ -2160,7 +2169,7 @@ bool createAndroidProject(const Options &options) if (options.verbose) fprintf(stdout, " -- Command: %s\n", qPrintable(androidTool)); - FILE *androidToolCommand = popen(androidTool.toLocal8Bit().constData(), "r"); + FILE *androidToolCommand = popen(androidTool.toLocal8Bit().constData(), QT_POPEN_READ); if (androidToolCommand == 0) { fprintf(stderr, "Cannot run command '%s'\n", qPrintable(androidTool)); return false; |