ENH: Using new Process SetWorkingDirectory method instead of manually implementing it.

This commit is contained in:
Brad King 2003-07-07 09:16:36 -04:00
parent b5fec4a3c8
commit 7479303e01
1 changed files with 1 additions and 16 deletions

View File

@ -378,19 +378,10 @@ bool cmSystemTools::RunCommand(const char* command,
return false;
}
// Change to specified working directory.
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
if(dir)
{
if(cmSystemTools::ChangeDirectory(dir) < 0)
{
return false;
}
}
output = "";
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin());
cmsysProcess_SetWorkingDirectory(cp, dir);
cmsysProcess_Execute(cp);
char* data;
@ -420,12 +411,6 @@ bool cmSystemTools::RunCommand(const char* command,
cmsysProcess_Delete(cp);
// Restore old working directory.
if(dir)
{
cmSystemTools::ChangeDirectory(cwd.c_str());
}
return result;
}