Fix crashes in LVM scanner when external device is unplugged without deactivating LVM partitions.
This commit removes stderror channel from output of external commands.
This commit is contained in:
parent
db836f292b
commit
2b9c63ffe0
|
@ -28,9 +28,10 @@
|
|||
|
||||
#include <QRegularExpression>
|
||||
#include <QStringList>
|
||||
#include <KMountPoint>
|
||||
|
||||
#include <KDiskFreeSpaceInfo>
|
||||
#include <KLocalizedString>
|
||||
#include <KMountPoint>
|
||||
|
||||
/** Constructs a representation of LVM device with functionning LV as Partition
|
||||
*
|
||||
|
@ -139,10 +140,12 @@ Partition* LvmDevice::scanPartition(const QString& lvpath, const LvmDevice& dev,
|
|||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
|
||||
//TODO: test used space report. probably incorrect
|
||||
if (mounted && freeSpaceInfo.isValid() && mountPoint != QString()) {
|
||||
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
||||
} else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem) {
|
||||
fs->setSectorsUsed(fs->readUsedCapacity(lvpath) / logicalSize());
|
||||
if (logicalSize() > 0) {
|
||||
if (mounted && freeSpaceInfo.isValid() && mountPoint != QString()) {
|
||||
fs->setSectorsUsed(freeSpaceInfo.used() / logicalSize());
|
||||
} else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem) {
|
||||
fs->setSectorsUsed(fs->readUsedCapacity(lvpath) / logicalSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ ExternalCommand::ExternalCommand(Report& report, const QString& cmd, const QStri
|
|||
void ExternalCommand::setup()
|
||||
{
|
||||
setEnvironment(QStringList() << QStringLiteral("LC_ALL=C") << QStringLiteral("PATH=") + QString::fromUtf8(getenv("PATH")) << QStringLiteral("LVM_SUPPRESS_FD_WARNINGS=1"));
|
||||
setProcessChannelMode(MergedChannels);
|
||||
setProcessChannelMode(SeparateChannels);
|
||||
|
||||
connect(this, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &ExternalCommand::onFinished);
|
||||
connect(this, &ExternalCommand::readyReadStandardOutput, this, &ExternalCommand::onReadOutput);
|
||||
|
|
Loading…
Reference in New Issue