summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-07-07 13:16:36 (GMT)
committerBrad King <brad.king@kitware.com>2003-07-07 13:16:36 (GMT)
commit7479303e01e01595ce384582ed5507909f3744dc (patch)
tree432c25ded5cfe2a736606877ce6de37f9f0aabd8 /Source
parentb5fec4a3c8fac315b1279abbe26df352780870bb (diff)
downloadCMake-7479303e01e01595ce384582ed5507909f3744dc.zip
CMake-7479303e01e01595ce384582ed5507909f3744dc.tar.gz
CMake-7479303e01e01595ce384582ed5507909f3744dc.tar.bz2
ENH: Using new Process SetWorkingDirectory method instead of manually implementing it.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSystemTools.cxx17
1 files changed, 1 insertions, 16 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 2cb2de3..d6ec70f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -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;
}