Check OS info from GUI #4933

This commit is contained in:
XinyuHou 2015-10-28 17:15:16 -07:00
parent d4d5d83bb6
commit 2535f3466c
3 changed files with 16 additions and 8 deletions

View File

@ -32,7 +32,7 @@ QString CommandProcess::run()
QProcess process;
process.setReadChannel(QProcess::StandardOutput);
process.start(m_Command, m_Arguments);
bool success = process.waitForFinished();
bool success = process.waitForStarted();
QString output, error;
if (success)

View File

@ -18,7 +18,7 @@
#include "QUtility.h"
#include "ProcessorArch.h"
#include "CommandProcess"
#include "CommandProcess.h"
#if defined(Q_OS_LINUX)
#include <QProcess>
@ -94,18 +94,20 @@ qProcessorArch getProcessorArch()
QString getOSInformation()
{
QString output;
QString result;
#if defined(Q_OS_LINUX)
CommandProcess cp("/bin/cat", "/etc/os-release");
QStringList arguments;
arguments.append("/etc/os-release");
CommandProcess cp("/bin/cat", arguments);
QString output = cp.run();
QRegExp resultRegex(".*PRETTY_NAME=\".*\".*");
QRegExp resultRegex(".*PRETTY_NAME=\"([^\"]+)\".*");
if (resultRegex.exactMatch(output)) {
QString OSInfo = resultRegex.cap(1);
output = OSInfo;
result = OSInfo;
}
#endif
return output;
return result;
}

View File

@ -94,6 +94,12 @@ QString WebClient::request(
{
QStringList args("--login-auth");
// hash password in case it contains interesting chars.
QString credentials(email + ":" + hash(password) + ":" + hash(getFirstMacAddress()) + "\n");
QString credentials(email + ":" + hash(password) + ":" + hash(getFirstMacAddress()));
QString os= getOSInformation();
if (!os.isEmpty()) {
credentials.append(":").append(os);
}
credentials.append("\n");
return m_CoreInterface.run(args, credentials);
}