Utils/VrUtils/Src/VrShellUtils.cpp
杰仔 9bcdc61c5a 初始提交:Utils 工具库模块
包含以下子模块:
- VrCommon: 核心接口和数据结构
- VrUtils: 工具类库(JSON、log4cpp、tinyxml2、INI、MD5、CRC)
- CloudUtils: 点云工具
- DataUtils: 数据处理工具(CloudMathClac、CoordinateTransform)
- CloudView: 点云查看工具

功能说明:
- 提供项目通用的基础工具类和实用功能
- 支持 Windows (MSVC/MinGW) 和 Linux (ARM/x86_64) 平台
- 使用 Qt qmake 构建系统
- 所有模块编译为静态库
2026-02-18 16:00:16 +08:00

44 lines
723 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "VrShellUtils.h"
#include <thread>
#include <chrono>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#ifndef _WIN32
#include <sys/wait.h>
#include <sys/ioctl.h>
#endif
/// @brief
/// Ö´ÐÐShellÃüÁî
/// <param name="data">[in]ShellÃüÁî</param>
int CVrShellUtils::ExecuCMD(const char *data)
{
int ret = 0;
#ifndef _WIN32
while (true)
{
ret = system(data);
if (WIFSIGNALED(ret) && (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
{
if (ret == 512)
{
break;
}
std::this_thread::sleep_for(std::chrono::seconds(1));
continue;
}
else
{
#ifdef SHELL_PRINT
LOG_DEBUG("execu %s successful code:%d", data, ret);
#endif
break;
}
break;
}
#endif
return ret;
}