diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-05-26 14:30:05 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-05-26 15:25:32 (GMT) |
commit | 67bb1ee50cde981dd36f2b9964013c330f7e92fe (patch) | |
tree | 1e6e4484530ff28ccfb0827f0925393c3d81dafd /Source/cmUVProcessChain.cxx | |
parent | cf7b7600c669ea162e0c3960c3e4e3a5d04f3274 (diff) | |
download | CMake-67bb1ee50cde981dd36f2b9964013c330f7e92fe.zip CMake-67bb1ee50cde981dd36f2b9964013c330f7e92fe.tar.gz CMake-67bb1ee50cde981dd36f2b9964013c330f7e92fe.tar.bz2 |
cmUVProcessChain: Add working directory option
Diffstat (limited to 'Source/cmUVProcessChain.cxx')
-rw-r--r-- | Source/cmUVProcessChain.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index 3faf2f6..5d00544 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -140,6 +140,13 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetExternalStream( return *this; } +cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetWorkingDirectory( + std::string dir) +{ + this->WorkingDirectory = std::move(dir); + return *this; +} + cmUVProcessChain cmUVProcessChainBuilder::Start() const { cmUVProcessChain chain; @@ -248,6 +255,9 @@ bool cmUVProcessChain::InternalData::AddCommand( arguments.push_back(nullptr); options.args = const_cast<char**>(arguments.data()); options.flags = UV_PROCESS_WINDOWS_HIDE; + if (!this->Builder->WorkingDirectory.empty()) { + options.cwd = this->Builder->WorkingDirectory.c_str(); + } std::array<uv_stdio_container_t, 3> stdio; stdio[0] = uv_stdio_container_t(); |