forked from qt-creator/qt-creator
PerfTracePointDialog: Use QtcProcess::setWriteData
There is only one write() after process has started, so use setWriteData() instead. Change-Id: I060b79926d9163d96d0bd1380b630191524daa96 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -99,6 +99,8 @@ void PerfTracePointDialog::runScript()
|
|||||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
|
|
||||||
m_process.reset(m_device->createProcess(this));
|
m_process.reset(m_device->createProcess(this));
|
||||||
|
m_process->setWriteData(m_ui->textEdit->toPlainText().toUtf8());
|
||||||
|
m_ui->textEdit->clear();
|
||||||
|
|
||||||
const QString elevate = m_ui->privilegesChooser->currentText();
|
const QString elevate = m_ui->privilegesChooser->currentText();
|
||||||
if (elevate != QLatin1String("n.a."))
|
if (elevate != QLatin1String("n.a."))
|
||||||
@@ -106,9 +108,6 @@ void PerfTracePointDialog::runScript()
|
|||||||
else
|
else
|
||||||
m_process->setCommand({"sh", {}});
|
m_process->setCommand({"sh", {}});
|
||||||
|
|
||||||
connect(m_process.get(), &DeviceProcess::started,
|
|
||||||
this, &PerfTracePointDialog::feedScriptToProcess);
|
|
||||||
|
|
||||||
connect(m_process.get(), &DeviceProcess::finished,
|
connect(m_process.get(), &DeviceProcess::finished,
|
||||||
this, &PerfTracePointDialog::handleProcessFinished);
|
this, &PerfTracePointDialog::handleProcessFinished);
|
||||||
|
|
||||||
@@ -118,12 +117,6 @@ void PerfTracePointDialog::runScript()
|
|||||||
m_process->start();
|
m_process->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfTracePointDialog::feedScriptToProcess()
|
|
||||||
{
|
|
||||||
m_process->write(m_ui->textEdit->toPlainText().toUtf8());
|
|
||||||
m_ui->textEdit->clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PerfTracePointDialog::handleProcessFinished()
|
void PerfTracePointDialog::handleProcessFinished()
|
||||||
{
|
{
|
||||||
if (m_process->exitCode() != 0) {
|
if (m_process->exitCode() != 0) {
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void runScript();
|
void runScript();
|
||||||
void feedScriptToProcess();
|
|
||||||
void handleProcessFinished();
|
void handleProcessFinished();
|
||||||
void handleProcessError(QProcess::ProcessError error);
|
void handleProcessError(QProcess::ProcessError error);
|
||||||
void finish();
|
void finish();
|
||||||
|
|||||||
Reference in New Issue
Block a user