forked from qt-creator/qt-creator
Implement setStandardInputFile() in ProcessLauncherImpl
Change-Id: I4d77c86ecb750573ce5421ca7300eb27f9f76108 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -58,12 +58,12 @@ StartProcessPacket::StartProcessPacket(quintptr token)
|
||||
|
||||
void StartProcessPacket::doSerialize(QDataStream &stream) const
|
||||
{
|
||||
stream << command << arguments << workingDir << env << openMode << channelMode;
|
||||
stream << command << arguments << workingDir << env << openMode << channelMode << standardInputFile;
|
||||
}
|
||||
|
||||
void StartProcessPacket::doDeserialize(QDataStream &stream)
|
||||
{
|
||||
stream >> command >> arguments >> workingDir >> env >> openMode >> channelMode;
|
||||
stream >> command >> arguments >> workingDir >> env >> openMode >> channelMode >> standardInputFile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ public:
|
||||
QStringList env;
|
||||
QIODevice::OpenMode openMode = QIODevice::ReadWrite;
|
||||
QProcess::ProcessChannelMode channelMode = QProcess::SeparateChannels;
|
||||
QString standardInputFile;
|
||||
|
||||
private:
|
||||
void doSerialize(QDataStream &stream) const override;
|
||||
|
||||
@@ -326,6 +326,7 @@ void LauncherHandle::doStart()
|
||||
p.workingDir = m_workingDirectory;
|
||||
p.openMode = m_openMode;
|
||||
p.channelMode = m_channelMode;
|
||||
p.standardInputFile = m_standardInputFile;
|
||||
sendPacket(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
|
||||
QProcess::ProcessError error() const { QMutexLocker locker(&m_mutex); return m_error; }
|
||||
QString program() const { QMutexLocker locker(&m_mutex); return m_command; }
|
||||
void setStandardInputFile(const QString &fileName) { QMutexLocker locker(&m_mutex); m_standardInputFile = fileName; }
|
||||
void setProcessChannelMode(QProcess::ProcessChannelMode mode) {
|
||||
QMutexLocker locker(&m_mutex);
|
||||
if (mode != QProcess::SeparateChannels && mode != QProcess::MergedChannels) {
|
||||
@@ -175,6 +176,7 @@ private:
|
||||
QString m_workingDirectory;
|
||||
QIODevice::OpenMode m_openMode = QIODevice::ReadWrite;
|
||||
QProcess::ProcessChannelMode m_channelMode = QProcess::SeparateChannels;
|
||||
QString m_standardInputFile;
|
||||
|
||||
CallerHandle *m_callerHandle = nullptr;
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
qint64 write(const QByteArray &data) override { QTC_CHECK(false); return -1; }
|
||||
void closeWriteChannel() override { /*QTC_CHECK(false);*/ }
|
||||
|
||||
void setStandardInputFile(const QString &fileName) override { QTC_CHECK(false); }
|
||||
void setStandardInputFile(const QString &fileName) override { m_handle->setStandardInputFile(fileName); }
|
||||
void setProcessChannelMode(QProcess::ProcessChannelMode mode) override { m_handle->setProcessChannelMode(mode); }
|
||||
|
||||
qint64 bytesAvailable() const override { QTC_CHECK(false); return 0; }
|
||||
|
||||
@@ -231,6 +231,7 @@ void LauncherSocketHandler::handleStartPacket()
|
||||
process->setEnvironment(packet.env);
|
||||
process->setWorkingDirectory(packet.workingDir);
|
||||
process->setProcessChannelMode(packet.channelMode);
|
||||
process->setStandardInputFile(packet.standardInputFile);
|
||||
process->start(packet.command, packet.arguments, packet.openMode);
|
||||
process->closeWriteChannel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user