我正在使用system()从我的应用程序运行一些Unix命令,代码如下:
std::stringstream command;
command << "rm -rf /some/directory";
int rmResult = system(command.str().c_str());
if (rmResult != 0) {
clog << "Error: Failed to remove old output directory '" << command.str()
<< "' (" << errno << ") " << strerror(errno) << ".\n";
throw;
}但是,当rmResult为零并且rm正常工作时,我在控制台中收到以下错误:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory我做错了什么?我如何才能让这条消息消失?
发布于 2011-01-04 11:05:35
显然,这是因为我的pushd堆栈中现在没有了一个目录,尽管它不是当前的工作目录。清理我堆栈的now gone目录,导致消息消失。
https://stackoverflow.com/questions/4590297
复制相似问题