summaryrefslogtreecommitdiffstats
path: root/Source/cmExecuteProcessCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-04-19 17:31:52 (GMT)
committerBrad King <brad.king@kitware.com>2019-04-19 17:32:08 (GMT)
commitd350fb688954f476d8df79bf582cf366b5861dd2 (patch)
tree38de48aa1db6d9d01cefb34a2fae07d8b126de52 /Source/cmExecuteProcessCommand.cxx
parenta289d7951734d7d107e3d3f780740e4f6f759b05 (diff)
downloadCMake-d350fb688954f476d8df79bf582cf366b5861dd2.zip
CMake-d350fb688954f476d8df79bf582cf366b5861dd2.tar.gz
CMake-d350fb688954f476d8df79bf582cf366b5861dd2.tar.bz2
execute_process: Manage KWSys Process lifetime with unique_ptr
Diffstat (limited to 'Source/cmExecuteProcessCommand.cxx')
-rw-r--r--Source/cmExecuteProcessCommand.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index ff6340f..de58c0b 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -119,7 +119,9 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
}
// Create a process instance.
- cmsysProcess* cp = cmsysProcess_New();
+ std::unique_ptr<cmsysProcess, void (*)(cmsysProcess*)> cp_ptr(
+ cmsysProcess_New(), cmsysProcess_Delete);
+ cmsysProcess* cp = cp_ptr.get();
// Set the command sequence.
for (std::vector<std::string> const& cmd : arguments.Commands) {
@@ -297,9 +299,6 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
}
}
- // Delete the process instance.
- cmsysProcess_Delete(cp);
-
return true;
}