Commit f26aa932 by 郭峰

Merge branch 'feature-1007488' into 'release'

Feature 1007488

See merge request !40
parents de180a5b 5603d29d
...@@ -488,20 +488,21 @@ inline bool pingAddress(const QString &address) { ...@@ -488,20 +488,21 @@ inline bool pingAddress(const QString &address) {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// Windows 指令 "ping IP -n 1 -w 超时(ms)" // Windows 指令 "ping IP -n 1 -w 超时(ms)"
QString cmdstr = QString("ping %1 -n 1 -w %2") QStringList arguments;
.arg(address).arg(1000); arguments << "-c" << "ping " + address + " -n 1 -w 1000";
#else #else
// Linux 指令 "ping -c 1 IP" // Linux 指令 "ping -c 1 IP"
QString cmdstr = QString("ping -c 1 %1") QStringList arguments;
.arg(address); arguments << "-c" << "ping -c 1 " + address;
#endif #endif
// 启动进程 // 启动进程
cmd.start(cmdstr); cmd.start("bash", arguments);
// 等待进程准备好读取 // 等待进程准备好读取
if (!cmd.waitForStarted()) { if (!cmd.waitForStarted()) {
qWarning() << "Failed to start 'ping' process for" << address; qWarning() << "无法启动的‘ping’进程" << address;
qWarning() << "命令: " << arguments.join(" ");
return false; return false;
} }
......
...@@ -13,6 +13,7 @@ TEMPLATE = app ...@@ -13,6 +13,7 @@ TEMPLATE = app
# deprecated API in order to know how to port your code away from it. # deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += APP_VERSION=\\\"1.3.2\\\" DEFINES += APP_VERSION=\\\"1.3.2\\\"
DEFINES += QT_MESSAGELOGCONTEXT DEFINES += QT_MESSAGELOGCONTEXT
DEFINES += QT_NO_DEBUG_OUTPUT DEFINES += QT_NO_DEBUG_OUTPUT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment