I am using system() to run some Unix commands from my application with code like the following:
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;
}
However, while rmResult is zero and the rm works, I get this error in the console:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
What am I doing wrong, and how can I get this message to go away?