mirror of
https://github.com/KDE/konsole.git
synced 2025-12-23 23:38:08 -05:00
Fix compilation for Qt < 6.9
readLineInto is not available in older Qt
This commit is contained in:
@@ -845,8 +845,9 @@ public:
|
||||
KSandbox::startHostProcess(proc, QProcess::ReadOnly);
|
||||
if (proc.waitForStarted() && proc.waitForFinished()) {
|
||||
proc.setReadChannel(QProcess::StandardOutput);
|
||||
quint8 buffer[4096];
|
||||
auto line = proc.readLineInto(buffer).trimmed();
|
||||
char buffer[4096];
|
||||
int readCount = proc.readLine(buffer, sizeof(buffer));
|
||||
auto line = readCount > 0 ? QByteArrayView(buffer, readCount).trimmed() : QByteArrayView();
|
||||
if (int colon = line.indexOf(": "); colon != -1) {
|
||||
setCurrentDir(QString::fromUtf8(line.mid(colon + 2)));
|
||||
return true;
|
||||
|
||||
@@ -311,15 +311,16 @@ int Pty::foregroundProcessGroup() const
|
||||
QStringLiteral("%p\t"),
|
||||
QStringLiteral("-o"),
|
||||
QStringLiteral("stat"),
|
||||
QStringLiteral("-t"),
|
||||
QStringLiteral("%1").arg(pty()->ttyName()),
|
||||
QStringLiteral("--tty"),
|
||||
QString::fromLatin1(pty()->ttyName()),
|
||||
QStringLiteral("--no-headers")});
|
||||
|
||||
KSandbox::startHostProcess(proc, QProcess::ReadOnly);
|
||||
if (proc.waitForStarted() && proc.waitForFinished()) {
|
||||
while (proc.canReadLine()) {
|
||||
quint8 buffer[256];
|
||||
const QByteArrayView line = proc.readLineInto(buffer);
|
||||
char buffer[256];
|
||||
int readCount = proc.readLine(buffer, sizeof(buffer));
|
||||
auto line = readCount > 0 ? QByteArrayView(buffer, readCount) : QByteArrayView();
|
||||
int i = line.indexOf('\t');
|
||||
if (i == -1) {
|
||||
return 0;
|
||||
|
||||
@@ -1239,8 +1239,9 @@ void Session::updateSessionProcessInfo()
|
||||
KSandbox::startHostProcess(proc, QProcess::ReadOnly);
|
||||
if (proc.waitForStarted() && proc.waitForFinished()) {
|
||||
proc.setReadChannel(QProcess::StandardOutput);
|
||||
quint8 buffer[256];
|
||||
auto line = proc.readLineInto(buffer).trimmed();
|
||||
char buffer[256];
|
||||
int readCount = proc.readLine(buffer, sizeof(buffer));
|
||||
auto line = readCount > 0 ? QByteArrayView(buffer, readCount).trimmed() : QByteArrayView();
|
||||
bool ok;
|
||||
auto pid = line.toInt(&ok);
|
||||
if (ok) {
|
||||
|
||||
Reference in New Issue
Block a user