summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-07-07 09:16:36 -0400
committerBrad King <brad.king@kitware.com>2003-07-07 09:16:36 -0400
commit7479303e01e01595ce384582ed5507909f3744dc (patch)
tree432c25ded5cfe2a736606877ce6de37f9f0aabd8 /Source
parentb5fec4a3c8fac315b1279abbe26df352780870bb (diff)
downloadcmake-7479303e01e01595ce384582ed5507909f3744dc.tar.gz
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 2cb2de3c15..d6ec70fce6 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;
}