mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
Consume all console output of ping process, to avoid noise in test output.
This commit is contained in:
@@ -61,20 +61,20 @@ namespace BlackMisc
|
||||
bool CNetworkUtils::canPing(const QString &hostAddress)
|
||||
{
|
||||
if (hostAddress.isEmpty()) { return false; }
|
||||
QStringList params;
|
||||
QProcess process;
|
||||
process.setProgram("ping");
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
params << "-n" << "1";
|
||||
process.setArguments({ "-n", "1", hostAddress });
|
||||
}
|
||||
else
|
||||
{
|
||||
// all UNIX alike
|
||||
params << "-c" << "1";
|
||||
process.setArguments({ "-c", "1", hostAddress });
|
||||
}
|
||||
params << hostAddress;
|
||||
|
||||
const int exitCode = QProcess::execute("ping", params);
|
||||
return exitCode == 0;
|
||||
process.start();
|
||||
process.waitForFinished();
|
||||
return process.exitCode() == 0;
|
||||
}
|
||||
|
||||
bool CNetworkUtils::canPing(const CUrl &url)
|
||||
|
||||
Reference in New Issue
Block a user