forked from qt-creator/qt-creator
Use QtcProcess in FormatTask
Change-Id: Ifd46259fc4e8b68342315a227748f2ecb9acc9d6 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -113,19 +113,19 @@ static FormatTask format(FormatTask task)
|
|||||||
return task;
|
return task;
|
||||||
|
|
||||||
case Command::PipeProcessing: {
|
case Command::PipeProcessing: {
|
||||||
QProcess process;
|
QtcProcess process;
|
||||||
QStringList options = task.command.options();
|
QStringList options = task.command.options();
|
||||||
options.replaceInStrings("%filename", QFileInfo(task.filePath).fileName());
|
options.replaceInStrings("%filename", QFileInfo(task.filePath).fileName());
|
||||||
options.replaceInStrings("%file", task.filePath);
|
options.replaceInStrings("%file", task.filePath);
|
||||||
process.start(executable, options);
|
process.setCommand({FilePath::fromString(executable), options});
|
||||||
|
process.setWriteData(task.sourceData.toUtf8());
|
||||||
|
process.start();
|
||||||
if (!process.waitForStarted(3000)) {
|
if (!process.waitForStarted(3000)) {
|
||||||
task.error = QString(QT_TRANSLATE_NOOP("TextEditor",
|
task.error = QString(QT_TRANSLATE_NOOP("TextEditor",
|
||||||
"Cannot call %1 or some other error occurred."))
|
"Cannot call %1 or some other error occurred."))
|
||||||
.arg(executable);
|
.arg(executable);
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
process.write(task.sourceData.toUtf8());
|
|
||||||
process.closeWriteChannel();
|
|
||||||
if (!process.waitForFinished(5000)) {
|
if (!process.waitForFinished(5000)) {
|
||||||
process.kill();
|
process.kill();
|
||||||
task.error = QString(QT_TRANSLATE_NOOP("TextEditor",
|
task.error = QString(QT_TRANSLATE_NOOP("TextEditor",
|
||||||
|
Reference in New Issue
Block a user